The Great Northern War
During the 30-years war Sweden had became a great power and it occuppied large territories in Livonia and Estonia along the Baltic coast and in Finland. Russia, at the beginning of Peter the Great's reign, was territorially a huge power, but with no access to the Black Sea, or to the Baltic Sea, and to win such an outlet became the main goal of Peter's foreign policy. Peter formed a great alliance with Saxony / Poland (Poland was at that time joined in a Union with Saxony) and Denmark, which started the Northern War in 1700.
Early in the war the Swedish king Charles XII defeated Peter (against 5 times numerically superior forces) at Narva on the Baltic coast. Instead of destroying the Russian army Charles XII turned against Poland in order to expell the Saxons and to insure the election of a friendly Polish king. Meanwhile Peter had restored his army and recaptured Narva.
In 1708/9 Charles XII launched his Russian campaign from Poland. He allied himself with the Cossacks to liberate the Ukraine and advance on Moscow. The onset of winter, epidemics and Russian raids weakened the Swedish army, and Charles XII had to turn southwards.
The Swedish and Russian armies clashed in the southern Ukraine where they fought a decisive battle at Poltava (1709). Peter personally prepared the battle : he transformed the battlefield by works of his engineers, who were ordered to erect redoubts in the paths of the Swedish troops to break their combat order, and to split them into little groups. The battle ended in total Swedish defeat and the wounded Swedish king had to escape to Turkey.
This was the first foreign catastrophe in Russia of modern times (as later by Napoleon and Hitler). Peter's victory at Poltava was followed by attacks on the Swedish possessions along the Baltic Sea with the result that Russia supplanted Sweden as the major power in the Baltic area.