John A. Boehner was narrowly reelected speaker of the House on Thursday, giving him a another chance to lead the chamber — a task that has been difficult for him over the past two years. The Ohio Republican survived a mini-rebellion among the most conservative members of the GOP caucus to win his second term as speaker.

Twelve Republican defected, with 10 voting for other conservatives and two abstaining. The final vote was 220 for Boehner to 192 for House Minority Leader Nancy Pelosi (D-Calif.). The winner needed 214 votes, a simple majority of the 427 lawmakers who voted.

Boehner watched the white-knuckle proceedings from off the floor. It was the closest any speaker has come to not securing a first-ballot victory since Newt Gingrich’s narrow reelection in January 1997, following an ethics admonishment.

The anti-Boehner faction cast its votes for a odd collection of Republicans, including tea party icon Allen B. West of Florida, a one-term congressman who lost his reelection bid in November. But it did not drain away enough support to topple the speaker. The position, second in the line of succession for the presidency, does not have to be held by a current member of Congress.

In an emotional speech after his victory, the speaker did not mention the opposition. Instead, he described his personal ethos of not being someone who seeks media attention. It was an acknowledgment of what some of his GOP colleagues consider one of Boehner’s problems, because he has been opposed by “show horses” who manage to get lots of attention for their opposing views.

Find out all about the new faces in the 113th congress — sort by state, party, gender and chamber and see who was elected where and why.

“So if you have come here to see your name in lights or to pass off political victory as accomplishment, you have come to the wrong place. The door is behind you,” the speaker said, at times fighting back tears. “If you have come here humbled by the opportunity to serve; if you have come here to be the determined voice of the people; if you have come here to carry the standard of leadership demanded not just by our constituents but by the times, then you have come to the right place.”

The tone of Thursday’s swearing-in was markedly different from Boehner’s first triumph two years ago, when the bulging GOP class of 2010 propelled Republicans into the majority and allowed Boehner to accomplish his career goal of being speaker.

But he has had trouble effectively wielding the speaker’s gavel at times. His hands-off style has often allowed minor rebellions to turn into major setbacks.

The vote came two days after the House passed a tax plan that avoided “fiscal cliff” austerity measures that were set to begin Jan. 1. The GOP leadership essentially ceded control of the floor to the Democratic minority for that vote, with Democrats providing 171 of the yes votes to approve the bill, while just 85 Republicans voted in support.

In that vote, the GOP leadership team spent a wild day trying to decide what to do with legislation that a clear majority of House Republicans opposed because it included tax increases on the wealthy.

Eventually Boehner voted for the legislation — along with Rep. Paul Ryan (Wis.), the GOP’s 2012 vice-presidential nominee — but his top deputies, House Majority Leader Eric Cantor (Va.) and House Majority Whip Kevin McCarthy (Calif.), opposed it.

After the tax legislation passed, the leadership team determined that it had burned up too much internal capital with its GOP members, so it allowed the 112th Congress to adjourn rather than approve billions of dollars in emergency aid to the victims of Hurricane Sandy.

That move helped Boehner within his Republican conference, but it proved to be a political debacle for the national GOP brand, at least in the short term. New Jersey Gov. Chris Christie, often mentioned as a potential Republican presidential candidate in 2016, accused Boehner of refusing to take his calls. Christie singled out Boehner for “the continued suffering of these innocent victims” of the storm.

Boehner faced the largest number of opposition votes from within his party in recent decades. His 220-vote tally is the lowest for any speaker or speaker-elect since January 1999, when J. Dennis Hastert (R-Ill.) was elected to his first term with 220 votes.

But Republicans held just 222 seats at the start of that Congress. Hastert had no votes of opposition, as he did not vote for himself and another Republican was not on hand for the tally.

In 1997, Gingrich (R-Ga.) received 216 votes, with nine votes of opposition from Republicans. Every other speaker since the Eisenhower administration has won his or her speaker’s election with more than 225 votes.

On Thursday, three dissenting Republicans voted for Cantor, who is considered more staunchly conservative, but the majority leader loudly shouted “John Boehner” when his name was sounded during the roughly hour-long roll call.

“There’s a lot of discontent out there,” said Rep. Justin Amash (R-Mich.), a member of the 2010 class who often jousts with the leaders. “Things have got to change, or we’re in a lot of trouble as a Republican caucus and as a nation.”

Having voted for another member of the 2010 class, Amash said he was not surprised by the outcome. He and other conservatives had discussed their picks ahead of time, so he knew Boehner was likely to win.

Even some Republicans who supported Boehner did so not because they thought he was successful at the job, but because they weren’t sure that anyone could do a better job of managing their unwieldy caucus.

“A lot of people back home don’t realize what a horrible hand the speaker’s been dealt on some of these things,” said Rep. Blake Farenthold (Tex.). “Obviously, I don’t agree with some of the things he’s done. But the guy’s working hard and doing the best he can with the resources he has.”

Rosalind S. Helderman contributed to this report.