Kiev and Moscow have agreed to extend the lease allowing Russia's Black Sea Fleet to be stationed in Ukraine by 25 years in return for cheaper gas.
The deal was signed in Kharkiv by Ukrainian President Viktor Yanukovych and Dmitry Medvedev of Russia.
The lease of Russia's naval base in Sevastopol, Crimea, had been due to expire in 2017.
The BBC reports the deal also has a clause allowing the lease to be extended for a further five years.
In return, Russia agreed to grant Ukraine a discount on imports of Russian gas.
The formula would give Ukraine a discount of $US100 for every 1,000 cubic metres of gas providing the benchmark rate was above $US330 or a discount of 30% if the rate was lower than that.
Ukraine currently pays $US305 per 1,000 cubic metres.
Tensions between Moscow and Kiev have led Gazprom cutting supply on a number of occasions in the past few years, affecting a number of European countries.
Europe gets a quarter of its gas from Russia, mostly via an extensive network of pipelines running through Ukraine.