Kiev has drawn up a sanctions list of 65 mainly Russian companies and 172 individuals and the new law now gives Ukraine's National Security and Defence Council - headed by the president - the right to impose the punitive measures.
"Bill on sanctions passed - our country will defend itself against the aggressor, its terrorists and their sponsors," Prime Minister Arseniy Yatsenyuk wrote on Twitter.
The law also allows Ukraine to stop the transit of goods across its territory, a move that could potentially see Russian gas blocked from transiting the country to Europe.
Lawmakers in Kiev dropped several controversial clauses from the bill that would have given security officials the right to ban any foreign or local media outlets without going to court.
The proposed legislation had been blasted as "very dangerous" by media watchdog Reporters Without Borders.