Barack Obama has pulled ahead in enough states to win the 270 electoral votes he needs to gain the White House -- with states to spare -- said an Associated Press analysis that shows he is now moving beyond typical Democratic territory to challenge John McCain on historically GOP turf.

Obama has 23 states and the District of Columbia, offering 286 votes, in his column or leaning his way, while Republican McCain has 21 states with 163 votes, according to the analysis, which is based on polls, the candidates' TV spending patterns and interviews with Democratic and Republican strategists. A half-dozen offering 89 votes -- Florida, Indiana, Missouri, North Carolina, Nevada and Ohio -- remain up for grabs. President Bush won all six in 2004, and they are where the race is primarily being contested in the homestretch.

Obama is still campaigning hard. "We have to work like our future depends on it in this last week, because it does," he said.

Less than a week before Election Day, the analysis isn't meant to be predictive but rather provides a snapshot of a volatile race. It's still possible McCain can pull off an upset.

Last month, in a similar analysis, Obama had an edge over McCain but hadn't laid claim to enough states to cross the 270-vote threshold.

Since then, the economic crisis has reshaped the race. And Obama has strengthened his grip in the contest by using his financial advantage to lock up most states that Democrat John Kerry won four years ago, even as he makes inroads into traditionally GOP turf.

The election's final week is being played out in the GOP bastions of Indiana and North Carolina, as well as perennial battlegrounds of Missouri and Nevada. Also on the list are the crown jewels of Florida and Ohio, which were key in deciding the past two presidential elections. McCain could sweep all six and still lose.

Obama is ahead in every state that Kerry won, including Wisconsin, Minnesota, Michigan and New Hampshire -- for a total of 41 votes. Among Kerry's states from 2004, only Pennsylvania, which hasn't voted for a Republican since 1988, remains realistically in McCain's sights. Some aides say a Pennsylvania victory, with 21 votes, could be what allows McCain to win the White House, provided he can thwart Obama in Bush-held states.

Over the past month, Obama has strengthened his standing in four of those offering a combined 34 votes. He has leads in Iowa and New Mexico polls. And Colorado and Virginia have started tilting more toward him. There are even signs that the race in McCain's home state of Arizona is narrowing. Polls show McCain with a single-digit lead, even though Obama hasn't targeted the state.

ASSOCIATED PRESS