Niners lock up cornerback Spencer to long-term deal

The San Francisco 49ers, a team that is starting to turn around after several bad seasons, made their first move in locking up players for the future by giving Shawntae Spencer a $20 million contract extension that will keep the cornerback with the team through 2012.

Spencer's deal could max out at $22 million. He received around $8.5 million in guarantees.

Spencer was a second-round choice of the 49ers in 2004.

During the first two offseasons of head coach Mike Nolan, the 49ers have built around their offense. They drafted quarterback Alex Smith last year, and they began adding offensive talent around him -- wide receiver Antonio Bryant, halfback Frank Gore, tight end Vernon Davis, among others.

With most of the moves happening on offense, Nolan likely will use 2007 and 2008 to bolster the defense. In the meantime, the organization is trying to identify some of its best young defensive players, and Spencer was the first to be rewarded.

He was signed through 2007 because his rookie contract voided in 2008. The 49ers didn't want Spencer to go into the final year of his contract next season with a chance to lose him in 2008.

John Clayton is a senior NFL writer for ESPN.com.