SAN FRANCISCO >> Matt Chapman, the most productive free agent the Giants added last offseason, has agreed to a long-term extension to stay with San Francisco through 2030, the team announced Wednesday night.

Chapman, 31, agreed to a six-year, $151 million contract with the Giants on Wednesday. He’ll earn $25 million each season from 2025 to 2030 and additionally receive a $1 million signing bonus in 2025.

Asked last month by this news organization about the possibility of a contract extension, Chapman expressed interest in staying in a Giants uniform.

“That’s not really my focus right now; my focus is on trying to make the playoffs,” Chapman said. “But the Giants, I love being here and they know that I want to be here. They know that I’m open to that. I’m kind of just waiting on them.”

Chapman has played all but four games this season, with one of his absences being a late scratch on the night of the club’s announcement. The four-time Gold Glover ranks 13th in MLB with 4.5 Fangraphs WAR among position players this season.

The Giants committed nearly $400 million in guaranteed contracts this past offseason, including an $18 million deal for Chapman in March that included a player option for 2026 and a mutual option in 2027. The six-year extension rips all of that up.

A two-time Platinum Glove winner, Chapman leads all third basemen in 2024 with 13 defensive runs saved. He leads the Giants in home runs (22), runs (90), doubles (33), hits (126) and RBI (69).Chapman’s new six-year extension is the richest contract president of baseball operations Farhan Zaidi has executed. The team’s press release did not include any mentions of options in his new deal.

The Orange County-raised Chapman played the first five years of his career with the A’s after being selected by Oakland in the first round of the 2014 draft out of Cal State Fullerton.

He was an All-Star in 2019 with the A’s, slugging a career-high 36 home runs and finishing sixth in the American League MVP vote as a key member of a team in the middle three consecutive playoff seasons. Oakland traded him to the Blue Jays during its teardown of that core in March 2022.

He played 295 of 314 possible games in Toronto over two seasons, winning his fourth Gold Glove in 2022, before returning to the Bay last spring with the Giants.