The Treaty of Valiesar (Estonian: Vallisaare vaherahu, Russian: Валиесарский договор 1658) was a treaty between Russia and Sweden, which concluded the Russo-Swedish theater of the Second Northern War. It was signed in the estate of Valiesar (Vallisaare) near Narva on 20 December 1658 (hence, the name). Russia was allowed to keep the conquered Livonian territories for three years — Kokenhusen, Dorpat, Marienborg, Syrensk, Yama, Dinaburg, Rēzekne and a few others.
When the term expired, Russia's military position in the war with Poland had deteriorated to such a point that tsar Alexei Mikhailovich could not allow himself to be involved into a new conflict against powerful Sweden. His boyars had no other choice but to sign the Treaty of Cardis in 1661, which obliged Russia to yield its Livonian and Ingrian conquests to Sweden, confirming the provisions of the Treaty of Stolbovo. This settlement was observed until the Great Northern War broke out in 1700.