DES MOINES, Iowa — Five weeks to Election Day, President Barack Obama is within reach of the 270 electoral votes needed to win a second term. Republican Mitt Romney's path to victory is narrowing.

To overtake Obama, Romney would need to quickly gain the upper hand in nearly all of the nine states where he and Obama are competing the hardest.

Polls show the president with a steady lead in many of them as Romney looks to shift the dynamics of the race, starting with their first debate Wednesday in Denver.

"We'd rather be us than them," says Jennifer Psaki, an Obama spokeswoman.

But Romney's running mate Paul Ryan says there's time for the GOP ticket to win. "In these kinds of races people focus near the end, and that's what's happening now," he told "Fox News Sunday."

If the election were held today, an Associated Press analysis shows Obama would win at least 271 electoral votes, with likely victories in crucial Ohio and Iowa along with 19 other states and the District of Columbia. Romney would win 23 states for a total of 206.

To oust the Democratic incumbent, Romney would need to take up-for-grabs Florida, Colorado, Nevada, North Carolina, New Hampshire and Virginia, which would put him at 267 votes, and upend Obama in either Ohio or Iowa.

The AP analysis isn't meant to be predictive. Rather, it is intended to provide a snapshot of a race that until recently has been stubbornly close in the small number of the most contested states.

It is based on a review of public and private polls, television advertising and numerous interviews with campaign and party officials as well as Republican and Democratic strategists in the competitive states and in Washington.

In the final weeks before the Nov. 6 vote, Obama is enjoying a burst of momentum and has benefited from growing optimism about the economy as well as a series of Romney stumbles. Most notably, a secret video surfaced recently showing the Republican nominee telling a group of donors that 47 percent of Americans consider themselves victims dependent on the government.

To be sure, much could change in the coming weeks, which will feature three presidential and one vice presidential debate. A host of unknowns, both foreign and domestic, could rock the campaign, knocking Obama off course and giving Romney a boost in the homestretch.

Barring that, Romney's challenge is formidable.

Obama started the campaign with a slew of electoral-rich coastal states already in his win column. From the outset, Romney faced fewer paths to cobbling together the state-by-state victories needed to reach the magic number.

It's grown even narrower in recent weeks, as Romney has seen his standing slip in polls in Ohio, with 18 electoral votes, and Iowa, with six. That forced him to abandon plans to try to challenge Obama on traditionally Democratic turf so he could redouble his efforts in Ohio and Iowa, as well as Colorado, Florida, New Hampshire, North Carolina, Nevada and Virginia.

Romney is hoping that come Election Day, on-the-fence voters tip his way. But there are hurdles there, too.

Early voting is under way in dozens of states, and national and key states surveys show undecided voters feel more favorably toward Obama than Romney.

The Republican is in a tight battle with Obama in Florida, as well as Colorado, North Carolina and Nevada.

But Ohio's shifting landscape illustrates Romney's troubles over the past few weeks.

Republicans and Democrats agree that Obama's solid lead in public and private polling in the state is for real. Over the past month, the president has benefited from an improving economic situation in the state; its 7.2 percent unemployment rate is below the 8.1 percent national average. Obama's team also attributes his Ohio edge to the auto bailout and GM plant expansions in eastern Ohio.

Obama and his campaign have hammered Romney on his tax policies, arguing that the former Massachusetts governor favors the rich while the president as a defender of everyone else.

The president has seen the same good fortune in Iowa. A poll released Saturday by The Des Moines Register illustrates his advantage, showing Obama with 49 percent to 45 percent for Romney. The margin of error was plus or minus 3.5 percentage points.

"It's a direct result of the time and resources he's been forced to spend here," said Iowa Republican strategist John Stineman.

Indeed, Obama intently focused on the state ahead of an early voting period that began last week. He campaigned in Iowa aggressively this summer and dumped in a ton of TV advertising, much of it depicting Romney as wealthy and out-of-touch with working Americans.

Obama doesn't just have the wind at his back in those states.

The president also appears to be in stronger shape than Romney in Virginia, which has 13 electoral votes, and in New Hampshire, with four votes, even though Romney vacations often in the state where he has a lakeside home. Romney and GOP allies are being outspent in that state considerably, a sign of trouble for the Republican challenger.

Underscoring his challenges, Romney also has been forced to spend millions of dollars a week defending himself in North Carolina, a GOP-leaning state that's more conservative than most of the states that will decide the election.

Polls now show a competitive race there. Democrats boast of having registered 250,000 new voters in the state since April 2011. It's an eye-popping total in a state that Obama won by just 14,000 votes four years ago. A flood of new voters, presumably a chunk of them Democrats, could help keep that state within Obama's reach this year.

Also, Romney's effort to challenge Obama in Democratic-leaning Wisconsin, home state of running mate Paul Ryan, appears to have fizzled. Despite millions of dollars spent on TV in the last few weeks by both sides, polls show Obama with a clear lead in Wisconsin.

Romney's goal of forcing Obama to defend Michigan – Romney's native state – and Pennsylvania never materialized.

"The big strategic moment coming out of the conventions in my view was whether or not Romney and his campaign could succeed in expanding the parameters of the battleground," said Tad Devine, a top adviser to 2000 Democratic nominee Al Gore and 2004 nominee John Kerry. "They have not been able to do that."

All this has left Romney with an extraordinarily tight path and few options but to bear down in the states where he is competing aggressively. Time, though, is running out.

___

Associated Press Deputy Director of Polling Jenifer Agiesta and AP news Survey Specialist Dennis Junius in Washington, Associated Press writers Dan Sewell in Ohio, Beth Fouhy in New York and Julie Pace in Chicago contributed to this report.

Also on HuffPost:

Loading Slideshow...
  • Birth Certificate -- "Born In The USA"

    <a href="http://www.huffingtonpost.com/2011/04/27/obama-birth-certificate-r_n_854248.html" target="_hplink"><strong>(April 27, 2011) --</strong></a> The White House <a href="http://www.whitehouse.gov/blog/2011/04/27/president-obamas-long-form-birth-certificate" target="_hplink">released</a> President Barack Obama's "long form" birth certificate, adding documentation to a longstanding discussion over his ability to serve as commander in chief. "We do not have time for this kind of silliness," Obama said. "We have better stuff to do. I have got better stuff to do. We have got big problems to solve." (JEWEL SAMAD/AFP/Getty Images)

  • Osama Bin Laden Killed -- "Tonight, Tonight"

    <a href="http://www.huffingtonpost.com/2011/05/01/osama-bin-laden-dead-killed_n_856091.html" target="_hplink"><strong>(May 1, 2011)</strong></a> -- In a televised address to the nation, Obama announces that Osama bin Laden is dead. His death was the result of a U.S. operation launched today in Abbottabad, Pakistan, against a compound where bin Laden was believed to be hiding. "[T]oday's achievement is a testament to the greatness of our country and the determination of the American people," Obama proclaimed. (Photo by Pete Souza/The White House via Getty Images)

  • Debt Ceiling Deal -- "Gold On The Ceiling"

    <a href="http://www.huffingtonpost.com/2011/08/02/obama-debt-ceiling-deal-jobs_n_916285.html" target="_hplink"><strong>(Aug. 2, 2011) --</strong></a> After the Senate passed a bill to raise the debt limit, Obama pleaded with Congress to shift their attention to jobs. "I will urge them to immediately take some steps -- bipartisan, common-sense steps -- that will make a difference; that will create a climate where businesses can hire, where folks have more money in their pockets to spend, where people who are out of work can find good jobs," he said. (Photo by Brendan Smialowski/Getty Images)

  • Don't Ask Don't Tell -- "Don't Stop Believin'"

    <a href="http://www.huffingtonpost.com/2011/09/20/barack-obama-dont-ask-dont-tell-repeal-statement_n_971662.html" target="_hplink"><strong>(Sept. 20, 2011) --</strong></a> As the ban on gays serving in the military came to an end, Obama hailed the fresh start, celebrating the fact that "patriotic Americans in uniform will no longer have to lie about who they are in order to serve the country they love." (Photo by Brendan Hoffman/Getty Images)

  • Iraq War To End -- "Homeward Bound"

    <a href="http://www.huffingtonpost.com/2011/10/21/obama-iraq-troop-withdrawal_n_1024108.html" target="_hplink"><strong>(Oct. 21, 2011) --</strong></a> Obama announced that all U.S. troops will be out of Iraq by 2011, fulfilling a promise that dated back to his campaign. "As a candidate for president, I pledged to bring the war in Iraq to a responsible end," Obama said. "So today I can report that, as promised, the rest of our troops in Iraq will come home by the end of the year." (Photo credit should read JIM WATSON/AFP/Getty Images)

  • Singing Al Green's "Let's Stay Together"

    <a href="http://www.huffingtonpost.com/2012/01/20/obama-al-green-apollo-theater_n_1218070.html" target="_hplink"><strong>(Jan. 20, 2012) --</strong></a> During a fundraiser at Harlem's historic Apollo Theater, Obama delivered a memorable musical message to his donors. With Rev. Al Green in attendance, Obama sang part of Green's hit song "Let's Stay Together," drawing strong applause from the crowd.

  • Singing Robert Johnson's "Sweet Home Chicago"

    <a href="http://www.huffingtonpost.com/2012/02/21/obama-sings-sweet-home-chicago_n_1292576.html" target="_hplink"><strong>(Feb. 21, 2012) --</strong></a> Days after his Al Green rendition, Obama flexed his vocal chords again with a hometown favorite. The East Room of the White House had its blues fix filled when the president started swinging "Sweet Home Chicago."

  • Gay Marriage -- "Can't Fight This Feeling"

    <a href="http://www.huffingtonpost.com/2012/05/09/obama-gay-marriage_n_1503245.html" target="_hplink"><strong>(May 9, 2012) --</strong></a> In a sit-down interview with ABC's Robin Roberts, Obama explained his evolution on the issue, affirming his support for gay marriage. "[A]t a certain point I've just concluded that for me personally it is important for me to go ahead and affirm that I think same sex couples should be able to get married," he said.

  • Immigration -- "With Arms Wide Open"

    <a href="http://www.huffingtonpost.com/2012/06/15/obama-immigration-order-deportation-dream-act_n_1599658.html " target="_hplink"><strong>(June 15, 2012) --</strong></a> The Obama administration addressed America's immigration issue, announcing that it will halt deportations and grant work permits to young individuals eligible for Dream-Act benefits. "They pledge allegiance to our flag," Obama said. "They are Americans in their hearts, in their minds, in every single way but one: on paper."(Photo by Alex Wong/Getty Images)

  • Health Care Reform -- "Beautiful Day"

    <a href="http://www.huffingtonpost.com/2012/06/28/supreme-court-health-care-decision_n_1585131.html" target="_hplink"><strong>(June 28, 2012) --</strong></a> After weeks of speculation that Obama's signature piece of legislation could be overturned, the Supreme Court ruled that the Affordable Care Act's individual mandate is constitutional. "It should be pretty clear that I didn't do this because it's good politics," <a href="http://www.huffingtonpost.com/2012/06/28/obama-health-care-ruling_n_1632953.html" target="_hplink">Obama said</a>. "I did it because it's good for the country." (Photo by Alex Wong/Getty Images)