After a spectacle of arm-twisting on the House floor, Kevin McCarthy won over just enough of the far-right rebels he needed to become speaker. He swore in the chamber’s members, ending days of paralysis at the start of Republican rule.

The Republican leader claws his way to the post in a dramatic late-night vote.

WASHINGTON — Representative Kevin McCarthy of California won election early Saturday as House speaker in a historic five-day, 15-ballot floor fight, after giving major concessions to right-wing holdouts and weathering a dramatic late-night setback that underscored the limits of his power over the new Republican majority.

Mr. McCarthy clawed his way to victory by cutting a deal that won over a sizable contingent of ultraconservative lawmakers on the 12th and 13th votes earlier in the day and then wearing down the remaining holdouts in a tense session that dragged on past midnight, ultimately winning with a bare majority, after a spectacle of arm-twisting and rancor on the House floor.