Free-agent infielder Jed Lowrie agreed to terms on a two-year deal with the New York Mets, ESPN's Jeff Passan reported Thursday.

Mark Feinsand of added that the deal is worth $20 million.

The 34-year-old has enjoyed a career renaissance over the past two seasons. Between 2017 and 2018, he was third among second baseman in WAR (8.5).

Lowrie is also coming off the best offensive year of his MLB career. He finished with 23 home runs, 99 RBI and a .267/.353/.448 slash line. His .347 weighted on-base average equaled his production from 2017 as well.

The Oakland Athletics defied all expectations and won 97 games to clinch a wild-card berth in the American League, and Lowrie was a big reason for Oakland's success.

"Jed has been an underappreciated player for a long time on this club," said Billy Beane, the Athletics' executive vice president of baseball operations, per NBC Sports Bay Area's Ben Ross. "He's been around for a lot of wins. He's had some great years. People don't talk nearly enough about him. Even the league doesn't. It was really satisfying... to see him make the All-Star team this year."

Lowrie told reporters in October he "made it abundantly clear" to the Athletics he would re-sign on the right terms.

His age was a big variable in his free agency, especially with regard to Oakland. He turns 35 in April and his value is almost certainly never going to be higher.

This year's free-agent class wasn't flush with elite second basemen, either. Brian Dozier had a disappointing 2018 season, while Asdrubal Cabrera, Daniel Murphy and Ian Kinsler will be 33, 34 and 37, respectively, next year.

Nobody can take issue with Lowrie capitalizing on what's likely to be his last opportunity to collect one more big payday.

Lowrie's departure from the Bay Area comes with a silver lining for the Athletics, who can focus on the development of Franklin Barreto. He made 32 appearances in the majors this season and finished with five home runs, 16 RBI and a .233/.253/.493 slash line.

The 22-year-old can play second base or shortstop, but displacing Marcus Semien at short might be difficult in 2019. The 28-year-old is under team control through 2020 and was third on the team in WAR (3.7) in 2018.

Now, Barreto is poised to take over as the everyday second baseman in 2019.

New York, meanwhile, adds key depth to its infield, which eight-time All-Star Robinson Cano this winter. Even if Lowrie regresses a bit, he should still be a productive hitter in the middle of the Mets' lineup.