David Wright has agreed to an eight-year contract to stay with the Mets.Getty Images

Finally, the Wright answer.

David Wright can count on spending the rest of his career with the Mets after reaching agreement on an eight-year contract worth $138 million to remain the Face of the Franchise, according to major league sources.

The deal, first reported by WFAN, is subject to Wright passing a physical and ends a saga that carried on for several weeks, beginning with general manager Sandy Alderson’s visit to Wright in October to make his sales pitch.

The extension will carry Wright, who turns 30 this month, through 2020 and give the Mets a cornerstone on which to build.

“This is a great step forward,” manager Terry Collins said. “It shows the organization steps up when they have to. It’s great for the Mets and our fans. I had all the confidence in the world it was going to get done before spring training.”

Wright’s deal, in terms of overall dollars, surpasses the $137.5 million contract Johan Santana received before the 2008 season, and ranks as the richest in franchise history. As The Post has been reporting, Wright’s camp believed it was important the third baseman’s new deal surpass Santana’s in overall dollars to establish a franchise benchmark.

The new money involved encompasses seven years and $122 million beginning in 2014. Wright’s $16 million deal for next year was torn up and replaced with the same dollar amount, making it an eight-year contract.

Wright, according to sources, felt significant process was made in talks with the Mets on Thursday, but there was still a gap that existed. That gap closed around 1:30 a.m. on Friday.

The gap, according to a source, involved deferred money. As The Post reported earlier this week the Wright camp was unhappy with the amount of deferred money in the offer.

All along, Wright had said he wanted discussions completed before spring training and wouldn’t negotiate once the season began.

With an offer extended to Wright, Alderson’s next focus will be clarifying R.A. Dickey’s status. The Mets have offered Dickey a two-year extension beyond 2013, and the knuckleballer has countered, but discussions were recently tabled to address Wright’s status.