The Marlins announced the deal, which includes a vesting option for 2021, on Monday, five days after the sides reportedly reached an agreement.
The deal is worth $50 million, with a $14 million vesting option for a sixth year, according to ESPN sources and Fox Sports. The deal was first reported Wednesday by Fox Sports.
"I'm thrilled to be affirming our long-term commitment to Dee Gordon, not only one of the most dynamic players in baseball but also an outstanding young man," Marlins owner Jeffrey Loria said in a statement. "It's truly incredible and historic what he did in his first season with our ballclub. He adds great energy and camaraderie in the clubhouse, but what's more, he's an exceptional person off the field."
The extension will cover Gordon's final three years of arbitration and his first two years of free agency.
"I instantly loved the way they treated me here," Gordon said. "Signing an extension was pretty much a no-brainer."
Gordon, 27, won the National League batting title last season by batting .333 with a league-leading 58 stolen bases. It marked the second straight season that Gordon led the NL in steals.
Gordon also led the league with 205 hits and scored 88 runs in his first season with the Marlins, who acquired the second baseman in a trade with the Los Angeles Dodgers. Gordon injured his thumb at midseason and missed 17 games, but he still became the first player since Jackie Robinson in 1949 to lead the NL in both batting average and stolen bases.
Gordon made the All-Star team for the second time, was chosen as the Marlins' MVP and led all NL second basemen in fielding percentage.
Gordon's father, former pitcher Tom Gordon, said his son still has room to grow as a player.
"He hasn't honed in on all of his skill set yet," the elder Gordon said. "My son is still five years away from understanding what his abilities actually are."
That sentiment is shared by Marlins president of baseball operations Michael Hill.
"That's what is amazing about who he is," Hill said. "He is still figuring things out. Yes, he has game-changing speed and is a difference-maker offensively and defensively, but his game is evolving."
Information from The Associated Press was used in this report.