(Photo by John McDonnell/The Washington Post)

Outfielder Bryce Harper and the Washington Nationals will avoid a grievance hearing over his 2015 salary after the sides reached a settlement Sunday evening with a two-year, $7.5 million contract, according to a person familiar with the situation.

Harper and the Nationals had been at odds over how his salary would be determined because of a rare dispute over the contract he signed as a first-round draft pick in 2010. If the sides had not settled, the Nationals and their most recognizable player would have engaged in a potentially contentious hearing Tuesday.

Harper and his agent, Scott Boras, believed Harper had the right to opt out of his prescribed 2015 salary ($1.5 million) and into baseball’s lucrative arbitration system. The Nationals contended his contract did not include the ability to opt out because such language had never been included in the deal.

Harper will make $2.5 million in 2015 and $5 million in 2016. Harper, 22, likely would have made about $2.5 million in 2015 through arbitration, according to an estimate made by MLBTradeRumors.com, although some in the industry believe he could have made more. In the arbitration system, salaries compound from year to year, so the amount at stake for Harper would be more than just this year’s salary.

Harper’s $5 million salary in 2016 gives him a guarantee to protect him against injury, which he has suffered through the past two seasons. It also gives the Nationals cost-certainty if Harper posts something close to an MVP-caliber season.

The agreement came before the situation could turn uglier following a weekend spat. Harper did not attend the team’s annual (and profitable) NatsFest fan rally Saturday, citing “matters out of my control.” General Manager Mike Rizzo said he was “disappointed” in Harper and declared Harper had stayed away because of the potential grievance.

Harper, one of the most marketable players in the sport, hit .273 with 13 homers and 32 RBI in his injury-shortened 2014. Already a two-time all-star, he flashed the potential for a breakout 2015 in the National League Division Series, blasting three homers in four games while going 5 for 17 with two walks.

Harper will be eligible for free agency after the 2018 season.

“We are pleased to have reached an agreement today with Bryce Harper,” the Nationals said in a statement. ” This is a fair agreement that benefits both sides.  We look forward to seeing Bryce on the field this spring and working towards a 2015 World Series Championship.” 

James Wagner contributed to this report.