The Marlins said the deal includes a third-year mutual option for 2022.
Mattingly, 58, has been managing in the final months of his current deal, with chief executive officer Derek Jeter saying in August that talks for Mattingly’s return had begun.
The Marlins are a National League-worst 53-99 this season entering Friday’s game against the Washington Nationals.
Mattingly, the longtime New York Yankees star who played 14 seasons (1982-95) — six fewer than Jeter — and made six All-Star teams, joined the Marlins in 2016. In four seasons as the manager in Miami, Mattingly owns a 272-364 record.
Overall, Mattingly has a 718-727 mark — a winning percentage of .497 — entering Friday’s game.
He previously managed the Los Angeles Dodgers from 2011-15, compiling a 446-363 regular-season mark while recording five winning seasons and three National League West titles.
Midway through Mattingly’s Marlins stint, the organization has undergone a massive roster rebuild. He initially was hired to lead a team with Giancarlo Stanton — who won National League MVP in 2017 — and two young outfielders in Christian Yelich and Marcell Ozuna, as the focal point of a core to develop. Ace pitcher Jose Fernandez died in a boating accident during Mattingly’s first season in 2016.
The Marlins instead shifted to a dramatic overhaul under Jeter and the new ownership group in Miami. Mattingly is poised to become the first Marlins skipper to manage in a fifth season.
Also on Friday, the Marlins announced they have reached agreement with shortstop Miguel Rojas, 30, on a two-year contract through 2021, with an option for 2022. Rojas is hitting .285 with five home runs and 45 RBIs this season, but suffered a strained hamstring and missed 23 games in August.
–Field Level Media (@FieldLevelMedia)