The Welsh Assembly has agreed to revise a plan to cut Tir Mynydd scheme support for Welsh less favoured area farmers by £12m a year.
Instead, at the last full plenary session before elections in May, opposition parties and two independent members agreed by 30 votes to 28 to back a Plaid Cymru proposal to reinstate much of the funding.
But most of the money will come from reducing spending on two agri-environment schemes by £10m, which rural affairs minister Carwyn Jones warned could be turned down by the EU.
During an acrimonious debate, which overran the allotted time, Mr Jones insisted that he did not have some sort of “evil plot” to slash hill farm incomes.
However, he reminded members that official figures showed that, in all but one of the last 10 years, hill farmers’ incomes were consistently higher than those of lowland producers.
He castigated opposition members for being willing to take money away from schemes designed to encourage environmentally friendly farming.
The vote was praised by Welsh farming unions as a life line to those who farmed the 80% of Welsh land within the LFA.
Dai Davies, president of NFU Cymru, said it would send a clear and unequivocal message to the next Welsh Assembly government that it had a mandate to reprioritise spending to support hill farmers.