Two-time championship coach Erik Spoelstra has agreed to a long-term contract extension with the Miami Heat, league sources told ESPN.

Spoelstra, who would have been entering the final season of his deal, quietly negotiated a new contract that allows him to continue as the league's second-longest-tenured active coach with one team, trailing only San Antonio's Gregg Popovich.

The extension will keep him under contract through the 2024-25 season, league sources said.

Spoelstra will be starting his 12th season as the franchise's head coach when the Heat open training camp on Tuesday. Spoelstra has a .590 regular-season winning percentage and .602 in the playoffs, including four trips to the NBA Finals and two NBA titles (2012 and 2013).

Spoelstra has developed a reputation as one of the league's best-prepared coaches, consistently maximizing and developing his talent. Beyond the Big Three era with Dwyane Wade, LeBron James and Chris Bosh, the Heat have succeeded with a number of reclamation projects, including undervalued and overlooked minor league players.

Miami missed the playoffs a season ago but acquired All-Star guard Jimmy Butler in the offseason to reshape a roster that is hopeful to return to the postseason for the ninth time in Spoelstra's tenure.

Spoelstra, 48, has spent his entire professional life with the Heat. He started in the video room and worked his way up as an advance scout and eventually the assistant coaching staff before replacing Heat president Pat Riley in 2008 as head coach.