There was jubilation as well in Kiev, the Ukrainian capital, after the signing of the agreement. By late afternoon on Friday, several hundred people had gathered in Independence Square, the focal point of months of street protests, many carrying blue balloons with yellow paper stars affixed to them — replicating the European Union flag — and released them into the air.

After weeks of statements by Mr. Poroshenko vowing to seal the agreement, the Kremlin was well-prepared and immediately began to lay the groundwork for retaliatory measures, including the withdrawal of preferential treatment for Ukrainian exports to Russia under prior agreements between former Soviet republics.

Within minutes of the signing ceremony, the news agency Interfax quoted Russia’s deputy foreign minister as warning that “serious consequences” would follow. The remark was an ominous sign of the vexation caused in Moscow by the tilt toward Europe of lands that Russia, first under czarist and then Soviet rule, for centuries considered its own.

In Moscow, Mr. Putin blamed the months of crisis in Ukraine on Western leaders, saying they had forced Kiev to choose between Russia and the European Union.

“The acute crisis in this neighboring country seriously troubles us,” Mr. Putin said after a ceremony to receive the credentials of foreign diplomats. “The anti-constitutional coup in Kiev and attempts to artificially impose a choice between Europe and Russia on the Ukrainian people have pushed society toward a split and painful confrontation.”

Though spurned, Moscow retains enormous influence in Ukraine. It reminded Kiev of this earlier this month by suspending deliveries of natural gas following a long-running dispute over price. Russia has denied any hand in the violence in eastern Ukraine but has been accused by the West of supporting pro-Russians rebels with guns, money and manpower from across the border in Russia.

Given the ferocity of the Kremlin’s campaign to prevent completion of the accord between Ukraine and Europe, the reaction by senior officials on Friday was relatively muted, reflecting not only acceptance of the inevitability of Mr. Poroshenko’s signing but also the changed circumstances following Russia’s annexation of Crimea, where it has a naval base.