MIAMI — The Marlins are no longer pinching pennies, and Giancarlo Stanton won’t be, either.

Stanton agreed to terms with the team Monday on a 13-year, $325 million contract, Miami owner Jeffrey Loria said. It’s the most lucrative deal for an American athlete and averages $25 million per season — or $154,321 per game.

The deal includes a no-trade clause, and Stanton can opt out after six years, Loria said.

“It’s a landmark moment for the franchise and Giancarlo, and it’s for the city and fans to rally around,” Loria said.

Any kind of multiyear deal is a big departure for the Marlins and Loria, whose frugal ways have alienated fans, angered the players’ union and made the franchise the butt of jokes.

Given such thriftiness, the Marlins’ generosity toward Stanton becomes even more stunning. His contract tops the 10-year, $292 million deal Miguel Cabrera agreed to with the Detroit Tigers in March. Alex Rodriguez signed the largest previous deal, a 10-year, $275 million contract with the Yankees before the 2008 season.

Stanton, who turned 25 on Nov. 8, is perhaps the game’s most feared slugger. He has 154 career homers despite playing in spacious Marlins Park.

“Giancarlo Stanton has come of age, and he’s going to be here a long time,” Loria said. “It’s wonderful to have a young man this caliber, integrity and ability, and I’m very happy.”

The Marlins right fielder and centerpiece wasn’t set to become eligible for free agency until after the 2016 season, and signing him to a long-term deal was considered a long shot. The Marlins haven’t reached the playoffs since 2003, and he was distrustful of the franchise’s direction.

Miami’s 2014 payroll of $52.3 million was the lowest in the majors. The last time they spent big was before the 2012 season, the first in their new ballpark. Then came a disastrous season and another salary purge, intensifying fan animosity toward Loria.

That sell-off and subsequent roster rebuilding set the stage for the Stanton deal, Loria said.

“Unfortunately people didn’t understand that two years ago, we had no choice,” the owner said. “I had to get to today.”

Loria said he doesn’t expect Stanton to opt out when he’s 31 and sees a positive side to the no-trade clause.

“There will be no distraction about, ‘Will he be traded?’ ” Loria said.

Stanton’s 2014 season ended Sept. 11 when he was hit in the face by a pitch and suffered fractures in his face and other injuries. Despite missing the final 17 games, he led the NL with 37 homers and a .555 slugging percentage for the Marlins, who went 77-85 but ended a three-year streak of last-place finishes in the NL East.

The Marlins have said they’re not concerned the injuries will have lingering effects. They made locking up Stanton their top offseason priority and overcame his skepticism about their efforts to fielding a winning team.

The Marlins believe they’re poised to contend next year with a young roster than includes right-handers Jose Fernandez and Henderson Alvarez, left fielder Christian Yelich, center fielder Marcell Ozuna and shortstop Adeiny Hechavarria.