Peers have accepted government plans to reform lobbying and charity campaign spending, avoiding a new stand-off with MPs by just one vote.
The Lords had inflicted three defeats on ministers during the passage of the Transparency of Lobbying, Non-Party Campaigning and Trade Union Administration Bill.
MPs overturned all three amendments.
Since the changes were not reinstated when the bill returned to the Lords, it will now become law.
One amendment resulted in a tied vote of 245 to 245, a highly unusual scenario in which the amendment falls as it is deemed not to have been positively agreed.
A Friends of the Earth spokeswoman said the charity was "bitterly disappointed" by the development.
"This is bad day for anyone wanting to protect the environment, save a hospital or oppose tuition fees," she said.
The bill aims to tighten regulation on campaign spending during election periods but it has faced criticism from those worried it could restrict campaigns by bodies that are not party political.
People or organisations who are not standing as candidates or political parties will have to register with the Electoral Commission if they spend a sufficiently large sum on campaigning.
But Lords were divided on whether some charities' staffing costs would be excluded form the calculations, resulting in the tied vote.
Crossbencher Lord Harries of Pentregarth, who tabled the amendment on staffing costs, warned that attempting to separate the cost of time spent by staff on campaign-related activities from their other jobs would be a "bureaucratic nightmare".
For Labour, Baroness Hayter of Kentish Town said that to include all staffing costs would be "simply not workable".
But crossbencher Lord Martin of Springburn spoke against the amendment, cautioning against the potential for well-resourced charities to "distort" elections and calling the coalition's proposal "a safer bet".
Lord Wallace of Tankerness, responding on behalf of the Cabinet Office, argued that Lord Harries' amendment "doesn't do what it says on the tin", and it fell in the the ensuing tied vote.
The bill will also impose a limit of £9,750 on the amount campaigners can spend within an individual constituency during election periods.
Lord Harries argued the proposal would make it too complex for charities and the Electoral Commission, who are responsible for policing the new arrangements, to work out which constituency money had been spent in.
But his compromise amendment was rejected by 249 votes to 231, a government majority 18.
Peers accepted without a vote the government's preferred position on special advisers. They will not be on the register of consultant lobbyists but, after a Commons compromise, the government is free to introduce regulations to include them in future.
Since peers did not overturn any changes made by MPs, both Houses of Parliament have agreed the current wording of the bill and it will receive royal assent and become law.
Friends of the Earth's Liz Hutchins said: "We are bitterly disappointed that ministers did not listen to the united voice of charities and campaigning groups on this poorly thought out legislation.
"Instead the government has forced through a bad bill in record time that will limit groups like Friends of the Earth from speaking out on behalf of their supporters ahead of elections."
Earlier in January, ministers offered concessions to opponents of the bill by exempting smaller charities from scrutiny and raising the amount campaigners could spend ahead of the 2015 general election.
In addition to the reforms on campaign spending, the legislation will also establish a register of professional lobbyists and change the legal requirements on trades unions to keep membership lists members up to date.