Senate Minority Leader Mitch McConnell (R-Ky.) put a halt to a filibuster bid before the Senate passed the bill. (Jonathan Ernst/Reuters)

After a dramatic vote, the Senate cleared the critical 60-vote threshold Wednesday that allowed for passage of legislation to suspend the Treasury’s borrowing limit.

The cliffhanger vote was scheduled for 15 minutes, but it lasted an hour. It ended when Senate Minority Leader Mitch McConnell (R-Ky.) and his leadership team voted to end a potential GOP filibuster, casting votes that left them exposed to attacks from conservative opponents.

After the filibuster threat was choked off, the Senate approved the debt ceiling legislation on a party-line vote, 55 to 43, sending it on to President Obama for his signature, ensuring that the Treasury will not default on more than $17 trillion in federal debt.

Stock markets, already jittery this month, started a slow but steady drop throughout the 2 o’clock hour as the vote looked in doubt, ending the day down slightly. The votes came two weeks before the Feb. 27 deadline established by Treasury Secretary Jack Lew, after which experts warned of havoc in financial markets if Congress did not act.

Democrats were relieved at the outcome. “It was painful to watch,” Sen. Patty Murray (Wash.) said afterward.

Since 1980, the debt ceiling has been raised 42 times.

That followed Tuesday’s vote in the Republican-controlled House, which required overwhelming Democratic support to approve the legislation.

The bill, which passed the House by a 221 to 201 vote, received the support of just 28 Republicans. In previous years, House Republicans had proved to be the greatest obstacles in striking compromise fiscal deals. So after the Tuesday vote, Senate approval was expected to be a pro forma matter.

Instead, Wednesday turned into a wild ride in the Senate. All the political unrest that has roiled the Republican Party in recent years — the establishment vs. conservative outsiders who threaten incumbent Republicans with primary challenges from the right — was on full display.

As he has for the past year, Sen. Ted Cruz (R-Tex.) placed himself at the center of the day’s action. McConnell and Majority Leader Harry M. Reid (D-Nev.) had sought to allow a simple majority – all Democrats – to approve the suspension of the debt limit until March 2015. But Cruz refused to go along, forcing more complicated procedural moves. That infuriated his Republican colleagues, because it meant that at least five GOP senators would have to vote with the Democrats to end the filibuster.

“Today was a classic victory for Washington establishment interests, and the people who lost today are the American people,” Cruz told reporters after the vote. He said he didn’t regret forcing 12 Republicans into a vote that could hurt them with conservative voters in GOP primaries.

“It should have been an easy vote,” he said. Cruz declined to say whether he supported McConnell’s continued leadership of the Republican caucus. “That is ultimately a decision . . . for the voters of Kentucky,” he said before ducking into an elevator.

McConnell is facing a difficult reelection bid. If he fends off a challenge by a conservative businessman in the Republican primary, he will confront Kentucky Secretary of State Alison Lundergan Grimes in the general election in November.

Republicans had been trying to warm up to their relatively new colleague after openly feuding with him in the fall, but Wednesday’s actions brought out Cruz’s critics again. “There was no endgame there,” said Sen. Bob Corker (R-Tenn.). “There was no stated outcome by anyone other than a clean debt ceiling. We can put the country through two weeks of turmoil, or we can get this vote done.”

The drama came at 2 p.m. as Republicans exited a closed-door lunch without a clear plan for how many would join with the 55 members of the Democratic caucus to end the filibuster, but they were determined to avoid having the vote fail and create financial uncertainty as the deadline neared.

Early in the vote, just two or three Republicans had given their support on the procedural vote. A long standoff ensued. Attention focused on Sen. Lisa Murkowski (R-Alaska), who has supported many recent compromises with Democrats but was initially unwilling to stick her neck out without a lot of support from other senior Republicans.

“I got a chance to visit with a lot of close friends,” Murkowski joked afterward, alluding to the many huddles she had on the floor with McConnell.

Murkowski lost her 2010 Republican primary to a tea party-backed challenger but then won the general election as a write-in candidate.

At that point, McConnell’s leadership team was unanimously opposed to cutting off the filibuster, but in a surprise move, the GOP leader and his top deputy, Minority Whip John Cornyn (R-Tex.), stepped up to vote yes.

Rank-and-file Republicans appreciated the tough votes by McConnell and Cornyn.

“They did what they thought was best for the party and the future of the caucus. I think people appreciate that,” said Sen. Lindsey O. Graham (R-S.C.), who is facing a collection of primary challengers this year. Graham voted to sustain the filibuster.

“They were leaders who led,” Sen. Mark Kirk (R-Ill.), who was one of the first yes votes among Republicans, told reporters.

Once the threat of a filibuster was thwarted, the 12 Republicans then flipped around and voted against final passage of the debt ceiling suspension.