WASHINGTON – In a triumph for President Barack Obama, the Democratic-controlled House narrowly passed sweeping legislation Friday that calls for the nation's first limits on pollution linked to global warming and aims to usher in a new era of cleaner, yet more costly energy.

The vote was 219-212, capping months of negotiations and days of intense bargaining among Democrats. Republicans were overwhelmingly against the measure, arguing it would destroy jobs in the midst of a recession while burdening consumers with a new tax in the form of higher energy costs.

At the White House, Obama said the bill would create jobs, and added that with its vote, the House had put America on a path toward leading the way toward "creating a 21st century global economy."

The House's action fulfilled Speaker Nancy Pelosi's vow to clear major energy legislation before July 4. It also sent the measure to a highly uncertain fate in the Senate, where Majority Leader Harry Reid said he was "hopeful that the Senate will be able to debate and pass bipartisan and comprehensive clean energy and climate legislation this fall."

Obama lobbied recalcitrant Democrats by phone from the White House as the House debate unfolded across several hours, and Al Gore posted a statement on his Web site saying the measure represents "an essential first step towards solving the climate crisis." The former vice president won a Nobel Peace Prize for his work drawing attention to the destructive potential of global warming.

On the House floor, Democrats hailed the legislation as historic, while Republicans said it would damage the economy without solving the nation's energy woes.

It is "the most important energy and environmental legislation in the history of our country," said Rep. Ed Markey of Massachusetts. "It sets a new course for our country, one that steers us away from foreign oil and towards a path of clean American energy."

But Rep. John Boehner, the House Republican leader, used an extraordinary one-hour speech shortly before the final vote to warn of unintended consequences in what he said was a "defining bill." He called it a "bureaucratic nightmare" that would cost jobs, depress real estate prices and put the government into parts of the economy where it now has no role.

The legislation would require the U.S. to reduce carbon dioxide and other greenhouse gas emissions by 17 percent from 2005 levels by 2020 and by about 80 percent by mid-century. That was slightly more aggressive than Obama originally wanted, 14 percent by 2020 and the same 80 percent by mid-century.

U.S. carbon dioxide emissions from the burning of fossil fuels are rising at about 1 percent a year and are predicted to continue increasing without mandatory limits.

Under the bill, the government would limit heat-trapping pollution from factories, refineries and power plants and issue allowances for polluters. Most of the allowances would be given away, but about 15 percent would be auctioned by bid and the proceeds used to defray higher energy costs for lower-income individuals and families.

"Some would like to do more. Some would like to do less," House Majority Leader Steny Hoyer, D-Md., said in advance of the final vote. "But we have reached a compromise ... and it is a compromise that can pass this House, pass that Senate, be signed by the president and become law and make progress."

That seemed unlikely, judging from Reid's cautiously worded statement. "The bill is not perfect," it said, but rather "a good product" for the Senate to begin working on.

And there was plenty to work on in a House-passed measure that pointed toward higher electricity bills for the middle class, particularly in the Midwest and South, as well as steps to ease the way for construction of new nuclear reactors, the first to be built since the accident at Three Mile Island in 1979.

The bill's controversy was on display in the House, where only eight Republicans joined 211 Democrats in favor, while 44 Democrats joined 168 Republicans in opposition. And within an hour of the vote, both party campaign committees had begun attacking lawmakers for their votes.

One of the biggest compromises involved the near total elimination of an administration plan to sell pollution permits and raise more than $600 billion over a decade — money to finance continuation of a middle class tax cut. About 85 percent of the permits are to be given away rather than sold, a concession to energy companies and their allies in the House — and even that is uncertain to survive in the Senate.

The final bill also contained concessions to satisfy farm-state lawmakers, ethanol producers, hydroelectric advocates, the nuclear industry and others, some of them so late that they were not made public until 3 a.m. on Friday.

Supporters and opponents agreed the bill's result would be higher energy costs but disagreed vigorously on the impact on consumers. Democrats pointed to two reports — one from the nonpartisan Congressional Budget Office and the other from the Environmental Protection Agency — that suggested average increases would be limited after tax credits and rebates were taken into account. The CBO estimated the bill would cost an average household $175 a year, the EPA $80 to $110 a year.

Republicans questioned the validity of the CBO study and noted that even that analysis showed actual energy production costs increasing $770 per household. Industry groups have cited other studies showing much higher costs to the economy and to individuals.

The White House and congressional Democrats argued the bill would create millions of "green jobs" as the nation shifts to greater reliance on renewable energy sources such as wind and solar and development of more fuel-efficient vehicles — and away from use of fossil fuels such as oil, gas and coal.

It will "make our nation the world leader on clean energy jobs and technology," declared Rep. Henry Waxman, D-Calif., who negotiated deals with dozens of lawmakers in recent weeks to broaden the bill's support.

Pelosi, D-Calif., took an intense personal interest in the measure, sitting through hours of meetings with members of the rank and file and nurturing fragile compromises.

At its heart, the bill was a trade-off, less than the White House initially sought though it was more than Republicans said was acceptable. Some of the dealmaking had a distinct political feel. Rep. Alan Grayson, a first-term Democrat, won a pledge of support that $50 million from the proceeds of pollution permit sales in the bill would go to a proposed new hurricane research facility in his district in Orlando, Fla.

In the run-up to the vote, Democrats left little to chance.

Rep. Ellen Tauscher, D-Calif., confirmed by the Senate on Thursday to an administration post, put off her resignation from Congress until after the final vote on the climate change bill. And Rep. Patrick Kennedy, D-R.I., who has been undergoing treatment at an undisclosed facility, returned to the Capitol to support the legislation. He has said he struggles with depression, alcoholism and addiction, but has not specified the cause for his most recent absence.