As Congress wrestles with reducing the budget deficit , federal science funding emerged relatively unscathed last week after the House and Senate worked out a deal for fiscal 2012, which began Oct. 1.

House Republicans had threatened to slash NASA’s budget by more than $1.5 billion and reduce research funding at the National Science Foundation. Instead, “NASA and NSF came out better than we feared,” said Alan Leshner, chief executive of the American Association for the Advancement of Science.

The deal boosts NSF funding to $7 billion, $173 million above last year’s budget. And while NASA will receive $17.8 billion — about $650 million less than last year — the hit is almost $1 billion less than that sought by House Republicans.

Two other research agencies, the National Institute of Standards and Technology and the National Oceanic and Atmospheric Administration, received small boosts as well.

The agreement funds NASA’s top priorities, including a next-generation space telescope, a new giant rocket and a deep-space capsule to carry astronauts far beyond Earth.

In return, though, the quest to ferry astronauts to the international space station aboard American-built spacecraft took a hit that may delay launch of the vehicles beyond NASA’s target date of 2016.

The deal resolves a budget fight that erupted this summer over the skyrocketing costs of the James Webb Space Telescope, NASA’s successor to the Hubble Space Telescope. In July, NASA’s chief purse-string-holder in the House, Rep. Frank Wolf (R-Va.), zeroed out funding for the project, which NASA now says will cost $8.8 billion to build and operate for 10 years.

But the telescope’s champion in the Senate, Barbara A. Mikulski (D-Md.), succeeded in restoring the funding, and the agreement will fund the telescope in fiscal 2012. The bill caps total costs to build the telescope at $8 billion and holds a NASA manager directly accountable for any further cost overruns.

“I wanted to make sure we were getting a handle on the Webb,” Wolf said. “I never wanted to kill it.”

Debra Elmegreen, president of the American Astronomical Society, is a key advocate for the telescope, slated for launch in 2018. “For this year, it looks like everything is on track,” she said. “This is exactly what we wanted.”

The telescope will receive $529 million in 2012, $375 million more than NASA had originally projected. The additional amount will be paid for via “commensurate reductions in other programs,” according to the congressional budget report released last week. Although the bill does not pinpoint which NASA programs will be cut, scientists planning future robotic missions to Mars and other planets worry that their programs will be squeezed.

Meanwhile, NASA’s plans to eventually send astronauts far beyond Earth received more than $3 billion. The budget provides $1.9 billion to develop a giant rocket called the Space Launch System and $1.2 billion for the Orion crew capsule. Earlier in November, NASA announced an Orion test launch in 2014, but the big new rocket won’t fly until at least 2017.

Senate supporters ensured that the Space Launch System, which heavily relies on Gulf Coast factories that built the space shuttle, received full funding.

“This budget makes a major investment in the next generation of human space flight,” said Sen. Bill Nelson (D-Fla.) in a statement. Nelson and Kay Bailey Hutchison (R-Tex.) pressed House colleagues to support the rocket.

But their prize comes at a price: a likely delay in flights of American spacecraft to the space station. Obama asked for $850 million in fiscal 2012 for NASA’s “commercial crew” initiative, which in April doled out $270 million to four American companies to develop rockets, capsules and space planes to ferry astronauts to the space station. Instead, NASA will get $406 million.

“We have a very, very tight budget,” Wolf said. “Everything is a compromise.”

The reduced funding will most likely push the launch of American-built space taxis beyond the 2016 target date, said William Gerstenmaier, the agency’s associate administrator for human exploration and operations, during House testimony Oct. 26.