WASHINGTON — The Senate on Tuesday overwhelmingly approved sweeping changes in the way Medicare pays doctors, clearing the bill for President Obama and resolving an issue that has bedeviled Congress and the Medicare program for more than a decade.

The 92-to-8 vote in the Senate, following passage in the House last month by a vote of 392 to 37, was a major success for Republicans, who devised a solution to a complex policy problem that had frustrated lawmakers of both parties. Mr. Obama has endorsed the bill, saying it “could help slow health care cost growth.”

The bill, drafted in the House in negotiations between Speaker John A. Boehner and Representative Nancy Pelosi, the Democratic leader, also extends the Children’s Health Insurance Program for two years, through 2017.

Without action by Congress, doctors would have faced a 21 percent cut in Medicare fees on Wednesday or Thursday. Senate leaders cleared the way for final passage by allowing votes on several amendments sought by liberal Democrats and conservative Republicans.