He spent a lot. He needed every penny.

State Senator Chris Koster of Harrisonville barely won the Democratic primary for Attorney General. He beat State Representative Margaret Donnelly by 786 votes, according to unofficial results from the Secretary of State’s office. Koster achieved the narrow victory, in part, by outspending every candidate the final week of the campaign. Every candidate; even the two presidential candidates.

The St. Louis Post-Dispatch reports that Koster spent at least $1.21 million the last month of the campaign, mostly for TV. TNSMI-Campaign Media Analysis Group monitored campaign spending for the Post-Dispatch. It reports Koster ran more than 2,700 ads in the metro regions of St. Louis, Kansas City and Springfield. About a quarter of the ads came during the last week. Koster spent at least $220,487 on television the last week of the campaign, compared to $138,796 by Donnelly.

In contrast, both presidential candidates, Democrat Barack Obama and Republican John McCain, spent more than a $1 million each in Missouri during the last month.

The analysis done for the newspaper discloses that the two Republican candidates for governor, northeast Missouri Congressman Kenny Hulshof and State Treasurer Sarah Steelman, nearly match each other dollar-for-dollar during the final month of the campaign.

Steelman spent slightly more. She paid $928,135 to run 2,320 spots, mainly in the more expensive media markets. Hulshof spent $914,308 to buy 2,892 spots throughout the state. Hulshof defeated Steelman by four-and-a-half percent on Tuesday.