There was a less obvious calculation behind the focus on Iowa: race. A victory in an overwhelmingly white state like Iowa would remove the fears of black voters that Mr. Obama could never get elected president because whites would not vote for him.

“The biggest race problem we had to start was not with the white voters,” Mr. Axelrod said, “but with African-American voters, a deep sense of skepticism that this might happen.”

Mr. Obama got his victory in Iowa, but things did not go as planned in New Hampshire. Mr. Axelrod remembered the moment he realized Mrs. Clinton was back on the march: when she teared up in response to a supporter’s warm words at a coffee shop. As Mr. Axelrod and Mr. Obama viewed the video of the episode as their campaign bus rumbled through New Hampshire, Mr. Axelrod realized that she had accomplished something Mr. Obama had not: presenting herself as a real person with real concerns to voters in a state that even then was anxious about the economy.

When aides delivered the disappointing New Hampshire results to Mr. Obama, he smiled. “Well,” he said, “I guess this is going to go on for a while.” Later, he conceded that he had been too confident after Iowa but said that the defeat would allow him to remake himself.

Unlike the Clinton campaign, the Obama team at least had a well-thought-out plan for how to proceed deeper into the primary season, mostly by concentrating on picking up delegates in red states and in states with caucuses where the Obama campaign’s organizational strengths and financial advantage could be put to use.

Going head to head with Mrs. Clinton over such a long period of time would test Mr. Obama, and demonstrate that he had the fortitude to endure a hard fight. Mrs. Clinton opened up lines of critique that were later picked up by Mr. McCain: that Mr. Obama’s stated openness to meeting with the leaders of rogue countries “without preconditions” was naïve; that for all of his great oratory, he was not offering substance; and that he lacked the mettle and experience to lead a nation through crisis.

And as Mrs. Clinton found her voice as a heroine of the struggling working class, she tried to cast Mr. Obama as elite. At a fund-raiser in San Francisco, Mr. Obama had described some white working-class voters as “bitter,” a characterization she used to suggest that her rival was out of touch with the values of ordinary Americans.