There were celebrations in Buenos Aires when the result was announced
The Argentine Senate has narrowly rejected controversial tax increases on agricultural exports that have provoked repeated protests by farmers.
With senators tied 36 to 36 after more than 16 hours of debate, Vice-President Julio Cobos cast the deciding vote to reject his government's proposals.
The outcome is as a blow to President Cristina Fernandez, correspondents say.
Farmers said the taxes would be crippling, but the government said they were needed to fight poverty.
Farmers have won a critical battle but the dispute is not over and Argentina faces some tough days and weeks ahead, says the BBC's Daniel Schweimler in Buenos Aires.
The government has said that it will seek another vote in the lower house, which passed the measures earlier this month.
Mr Cobos, who is also leader of the Senate, said it had been "the most difficult day of my life".
Close to tears, he cast his deciding vote.
"They tell me I must go along with the government for institutional reasons, but my heart tells me otherwise. May history judge me, my vote is not for, it's against," he said.
Government supporters and farmers held rival demonstrations this week
In a Buenos Aires park, hundreds of farmers and their supporters erupted in cheers after watching the vote on big-screen televisions.
Argentina is a major producer of soya, grains and beef, which fetch high prices on international markets.
The dispute between the government and farmers began in March, when President Fernandez's government raised taxes on soya exports from 35% to 45%, and imposed new taxes on other farm exports.
The government argued that they needed to raise taxes on agricultural exports to help build a new Argentina.
It said farmers could afford to pay more, as they were benefiting from high prices.
The authorities also accused farmers and their supporters of undermining democracy by refusing to respect the wishes of the elected government.
However, farmers' leaders said that any profits needed to be reinvested so that Argentina, one of the world's leading agricultural producers, could help to feed a hungry world.