"I pledge that this Congress will be transparent, bipartisan and unifying; that we will seek to reach across the aisle in this Chamber and across the divisions across our nation," Pelosi said.

Following the vote, Pelosi took the speaker's gavel from House Minority Leader Kevin McCarthy, holding it up to House members and smiling before delivering remarks. She promised to "stand our ground where we can, but always extend the hand of friendship."

Pelosi, the first woman to serve as speaker, takes the post again on the 13 th day of a partial government shutdown, amid a spat with Trump over whether to fund his proposed border wall. On immigration, health care and other issues, she has pledged to claw back against the president and the GOP. But she has promised to find areas to work with Republicans — potentially on updating infrastructure and lowering drug prices.

The California Democrat received 220 votes out of a possible 430. After numerous Democrats pledged to oppose Pelosi, only 15 members of the party voted against the representative on the House floor following her efforts to quash the opposition. After the vote was announced Thursday, Pelosi embraced colleagues as Democrats stood and applauded.

Pelosi, 78, starts her second stint leading the House after eight years of Republicans controlling the chamber. She will lead a Democratic majority at a time when the party has to decide when — and how forcefully — to challenge President Donald Trump and the GOP-held Senate.

The new Democratic-held House voted Nancy Pelosi its speaker on Thursday, vaulting the representative back to the pinnacle of her power at a critical moment for her party.

House Speaker-delegate Nancy Pelosi (D-CA) raises the gavel after being elected as House Speaker as the U.S. House of Representatives meets for the start of the 116th Congress inside the House Chamber on Capitol Hill in Washington, U.S., January 3, 2019.

Later in the day, Trump congratulated Pelosi and said "hopefully we're going to have a lot of things that we can get done together." He cited infrastructure as an area in which they can cooperate.

To reclaim the speaker's gavel, Pelosi navigated 2018 midterm elections in which she took a drubbing from Republicans and even many Democrats. After her party gained a net 40 GOP-held seats in November, she struck a series of deals to hold off rebellion within her party. Some Democrats who called for new leadership ended up opposing Pelosi for speaker, but she secured enough votes to lead the House again.

Democrats plan a flurry of activity with their new 235-199 majority in the House. They aim to pass bills Thursday night to reopen the nine unfunded U.S. departments, though the Senate has pledged not to take up the proposals as Trump threatens to veto them.

Democrats also plan to quickly pass a sweeping anti-corruption bill, among other largely symbolic measures meant to set a tone for their majority. In her remarks, Pelosi outlined several areas on which Democrats want to focus:

shielding the Affordable Care Act and Medicare, Medicaid and Social Security benefits

addressing climate change

cutting drug prices

overhauling U.S. infrastructure

strengthening gun background checks

ending discrimination against LGBTQ Americans

protecting young immigrants brought to the U.S. illegally as children.

Pelosi has stressed that she wants to focus first on noncontroversial measures with broad public support. She said the "overdue" proposals to boost background checks, strengthen LGBTQ protections and shield so-called Dreamers "have bipartisan support in this body."

Rep. Hakeem Jeffries, D-N.Y., nominated Pelosi for speaker on Thursday afternoon to loud applause from House Democrats and polite clapping from even some Republicans. The representative said "Nancy Pelosi is just getting started."

In introducing Pelosi, McCarthy called her an "experienced leader," a "fighter for her causes" and a "true trailblazer." He said a period of divided government "no excuse for gridlock and inaction."

However, he said "Republicans will always choose personal freedom over government control."

After holding off opposition both from the GOP and within her party, Pelosi faces new challenges in the nearly two years before the November 2020 presidential election. Democrats want to challenge Trump's policies and investigate what they call corruption in his administration. But they do not want to go too far and alienate the independent and moderate voters who they may need to win the presidency or keep the House in the next election.

Democratic leaders have pledged to go after Trump's tax returns and probe his personal businesses, among a bevy of other potential investigations. However, they see pushing for the president's impeachment as one way to drive voters back toward Trump.

In an interview with NBC's "TODAY" that aired Thursday morning, Pelosi said Democrats would wait to see the conclusion of special counsel Robert Mueller's Russia investigation before deciding whether to impeach Trump.

"We shouldn't be impeaching for a political reason, and we shouldn't avoid impeachment for a political reason," she said.

Pelosi has represented the San Francisco-area for more than 30 years. She has led House Democrats for more than 16 of those years.

Her first stint as speaker came lasted from 2007 to 2011, when she oversaw the House's response to the 2008 financial crisis and spearheaded the chamber's passage of the Affordable Care Act.

Subscribe to CNBC on YouTube.