Swedish power grew in the 17th century as Sweden steadily expanded and created a Baltic empire, including present-day Finland, Estonia, Latvia and the Neva area. It had also gained footholds in northern Germany in the form of several trading cities. Increasingly concerned, Saxony and Poland-Lithuania created an alliance with Russia and Denmark against Sweden, declaring war in 1700. While Sweden did enjoy sporadic military success, for the most part the war consisted of repeated Russian and Polish victories. Sweden managed to bring the Ottoman Empire into the war as a way to distract Russia, but this did not have as great an effect as desired. Russian forces immediately moved in to besiege the cities of Reval and Riga.
The main Swedish army came down from Riga and attacked Poland, and a long series of meetings (similar to the battles of Virginia in the later part of the American Civil War) resulted in an overall Polish victory. The Swedish army was driven to what is now western Ukraine, where it was resoundingly defeated at the Battle of Poltava in 1709. The Russian front against the Ottomans was much less successful, and despite initial Russian victories the Turks won a major battle in Bessarabia, capturing many Russian troops. Tsar Peter the Great immediately sued for peace with the Ottomans, realizing that they were not eager to fight. Making several diplomatic concessions (like guaranteeing the Ottoman presence in Romania), he refocused his efforts to the north.
Although Sweden's main force had been defeated at Poltava, it still had a superior naval presence that prevented the Russians from properly besieging Riga and Reval. With his most experienced generals, Anikita Repnin, Jacob Bruce, and Boris Sheremetev, fighting there, Peter sent Fyodor Apraksin to attack the town of Vyborg, on the road to Helsingfors. In 1710, Apraksin proved his abilities and took the town with an amphibious assault, allowing Russian troops to continue into Finland.
With Finland and their Baltic territories under occupation, and their German possessions taken by Saxony, Sweden was forced to sign a peace in 1721, resulting in the Treaty of Nystad. Sweden lost all of its territory in the east Baltic (Neva, Kurland, Livonia, and Prussia), which went over to Russia. After the conclusion of the war, Peter immediately began refortifying and rebuilding ruined cities and expanding his fleet, while expansion in Saint Petersburg continued. While Sweden's golden age had ended with the Great Northern War, Russia was reaching the peak of Peter the Great's successes and became recognized in Europe as a formidable military force.