Former Prime Minister Yulia Tymoshenko told the protesters that all opposition forces must unite to resist the deal signed earlier this week which she denounced as an "unprecedented step of national treason and shame."
The agreement signed Wednesday is the first concrete sign that newly-elected President Viktor Yanukovych will steer Ukraine back into Russia's orbit, reversing his pro-Western predecessor's attempts to decrease Moscow's influence.
The pact allows Russia to extend its lease of the Black Sea Port of Sevastopol for another 25 years after the current lease agreement expires in 2017. Russia immediately rewarded Yanukovych by giving the ex-Soviet republic steep discounts for the natural gas on which its industries depend.
Tymoshenko and other opposition leaders said the deal amounted to ceding control over the nation's territory.
"We are losing our territory, we are restricting our sovereignty," Tymoshenko said at the rally. "Yanukovych will split Ukraine in two as nobody has done before."
Yanukovych has broad support in the Russian-speaking east and south, but faces strong opposition in western Ukraine. He narrowly defeated Tymoshenko in February's vote.
The agreement is set to come up for ratification Tuesday in Russia and Ukraine. While Tymoshenko and other opposition leaders said they would try to block the vote, they will face an uphill battle in parliament controlled by Yanukovych's party and its allies.
Tymoshenko's ally, deputy parliament speaker Mykola Tomenko, said that even if parliament ratifies the deal Tuesday, "we will do our best to denounce it anyway, if not now, then later."
Police separated opposition demonstrators from several hundred Yanukovych supporters.
"We are defending the new authorities," said one of them, Valentyn Bodvin, a businessman. "The opposition has lost its chance. They were doing nothing for five years."