SAN DIEGO — Fernando Tatis Jr. has agreed to a $340 million, 14-year deal that will keep the electrifying shortstop with the San Diego Padres until he's 35 years old, according to two people familiar with the situation.

The two people spoke to The Associated Press on condition of anonymity Wednesday night because the deal hadn't been announced.

It will be the longest contract signed in MLB history. Giancarlo Stanton, now with the New York Yankees, signed a 13-year, $325 million deal with Miami in 2015. Bryce Harper signed a 13-year, $330 million deal with Philadelphia in 2019. The biggest deal by dollars remains Mike Trout's $426.5 million, 12-year deal signed with the Angels in 2019.

TIM TEBOW IS RETIRING FROM PROFESSIONAL BASEBALL: 'I LOVED EVERY MINUTE OF THE JOURNEY'

The 22-year-old Tatis has bloomed into a superstar in two full seasons with the Padres. He helped San Diego end a 13-year playoff drought in 2020 and win a wild-card series against the St. Louis Cardinals before the Padres were swept by the rival Los Angeles Dodgers in the NL Division Series.

San Diego Padres' Fernando Tatis Jr. reacts after hitting a two-run home run during the fifth inning of a baseball game against the Los Angeles Dodgers Wednesday, Aug. 5, 2020, in San Diego. (Associated Press)

San Diego Padres' Fernando Tatis Jr. reacts after hitting a two-run home run during the fifth inning of a baseball game against the Los Angeles Dodgers Wednesday, Aug. 5, 2020, in San Diego. (Associated Press)

San Diego promoted Tatis to the majors on opening day of 2019, forgoing the chance to delay his free agency by waiting a few weeks — a reality of the game experienced by other young stars like Kris Bryant with Chicago Cubs or Harper with the Washington Nationals.

Tatis has two years of service and would have been eligible for salary arbitration for the first time next offseason. While his deal sets a record for length, Tatis may have left dollars on the table if he continues on his star trajectory. His $24.29 million average salary will rank just 19th in the sport.

CLICK HERE TO GET THE FOX NEWS APP

The son of the former big league infielder with the same name, Tatis comes from San Pedro de Macoris, Dominican Republic, also known as the Cradle of Shortstops.

Tatis stands out because of his flair, easy smile, the blond dreadlocks flowing from under his cap, a uniform dirtied by his hard-charging play and his dance moves in the dugout after hitting home runs.

The Padres gave slugger Manny Machado a $300 million, 10-year deal before the 2019 season.