The Senate last night approved a $390 billion-plus spending package that sticks closely to a White House-imposed ceiling, after Republicans defeated Democratic moves to add billions of dollars for health care providers and job-training programs.

The long-delayed measure, which passed 69 to 29, funds federal departments and programs this year. It was the first major test of the newly installed Republican majority's ability to end last year's legislative stalemate in Congress. Democrats used the week-long debate to hone their message on the environment and health care, and attack Republicans for shortchanging domestic programs and pressing for tax cuts.

Republicans countered that the bill increases federal aid to education by more than 10 percent and provides modest relief for doctors facing cuts in Medicare payments, farmers suffering from drought and financially strapped states. It also provides a record $305 million in aid to Pakistan, a key U.S. ally in the war on terrorism.

Late yesterday, the Senate voted 50 to 47 to defeat an amendment offered by Sen. Barbara A. Mikulski (D-Md.) aimed at restricting a Bush administration plan to have private contractors and government employees compete for federal jobs.

The amendment would have barred the administration from setting targets or reserving quotas for the private sector. Mikulski said it would protect the Civil Service from "predators" and "bounty hunters."

But Sen. George Allen (R-Va.) said the amendment would limit the ability of high-tech and other businesses in Northern Virginia to win federal work.

Republican leaders expressed satisfaction at passage of the package, which includes 11 annual appropriations bills.

" "It's a pretty good accomplishment that we were able to defeat half a trillion dollars' worth of Democratic amendments," said Sen. Don Nickles (R-Okla.).

But hurdles lie ahead for the measure. Pressures to find ways around the $390 billion White House spending cap are sure to increase when negotiations begin with the House, which has different priorities in many key areas.

The strains were evident yesterday as budget officials looked to soften the impact of government-wide cuts in all domestic programs before sending the bill to the House. Cuts of about 2.9 percent were pushed through by the GOP to offset increases for education and other high-priority programs.

Budget officials were considering not counting $3.1 billion in drought aid for farmers and $1.3 billion for doctors and hospitals against the president's spending cap.

The White House yesterday appeared sensitive to the difficulties faced by GOP leaders. "We'd like all the spending to be within the president's top line, but the Senate will ultimately work its will," said Amy Call, spokeswoman for the Office of Management and Budget.

As the giant bill neared passage, senators rushed to add amendments as diverse as one making funds available for promoting Alaskan seafood, to another adding funding for global HIV-AIDS programs.

Approved by voice vote was a provision setting up tight congressional oversight of a controversial Pentagon surveillance program known as Total Information Awareness.

TIA, run by former national security adviser John Poindexter, is seeking to develop technologies to sift through databases and computer networks to identify threatening patterns of activity in everyday transactions such as travel reservations and credit card purchases.

The provision sponsored by Sens. Ron Wyden (D-Ore.) and Charles E. Grassley (R-Iowa) will require a report to Congress on the program. Congressional approval will be required for all activities except foreign intelligence-gathering.

Wyden called TIA "the most far-reaching surveillance program ever proposed."

Republicans earlier blocked a move by Sen. Hillary Rodham Clinton (D-N.Y.) to obtain a multibillion-dollar package of relief for hospitals, doctors, home health care providers, skilled nursing facilities and others facing cuts in Medicare payments.

But Sen. Jon Kyl (R-Ariz.) promised that Republicans would quickly take up the Medicare payment crisis.

Sen. Barbara Boxer (D-Calif.) refers to a list of Democratic legislative objectives and priorities at a news conference. Democrats' goals were compared with the president's. Behind Boxer is Sen. Jon S. Corzine (D-N.J.).Sen. Rick Santorum (R-Pa.) displays a "Democratic Spendometer" that criticizes Senate Democrats for what he called excessive spending.