Peralta emerged as one of the top offensive shortstops in baseball last year, his first full season in the major leagues. He batted .292 with 24 home runs and 78 RBIs in 141 games - setting a franchise record for homers by a shortstop with one more than Woodie Held hit in 1961.
"I think I can do even better this season," Peralta said. "I feel much more comfortable."
An ecstatic Peralta said he now can support his parents comfortably in retirement.
"When I was a boy, I dreamed of being a baseball player. I never thought of being a millionaire," he said. "But now, I can take care of my family without having to worry about anything except playing baseball."
Peralta's agent, Bill Rego, said the deal is "one of the top two" for a shortstop not yet eligible for arbitration. Nomar Garciaparra got $23.25 million over five years with the Boston Red Sox in 1998.