The agreement covers two arbitration years and three years of free agency. He had been due to be a free agent after the 2011 season.
Optimism for a deal has heated up in recent days; on Monday, SI.com reported the pitcher and team were close on terms.
Hernandez originally requested a six-year deal for $100 million while the Mariners were offering about $45 million for four years at the start, but talks proceeded well from there.
He will get a $3.5 million signing bonus and will make $6.5 million in 2010, $10 million in 2011, $18.5 million in 2012, $19.5 million in 2013 and $20 million -- including a prorated portion of the signing bonus -- in 2014, the final year of the contract.
Seattle and representatives for the 23-year-old right-hander exchange proposed arbitration figures Tuesday, with Hernandez asking for $11.5 million and the Mariners offering $7.2 million.
Hernandez's agents started talks with the Mariners soon after the pitcher finished second in voting for last year's AL Cy Young Award. Hernandez was 19-5 last season, tied for the most wins in the major leagues, made his first All-Star team and had a career-high 217 strikeouts with a career-low 2.49 ERA.
Hernandez went 15-2 with a 1.98 ERA after Mariners manager Don Wakamatsu called him out for not stepping up during a sloppy loss to the Angels on May 19.
A long-term agreement with Hernandez was the Mariners' top priority. Hernandez and trade acquisition Cliff Lee, signed through 2010, give Seattle one of baseball's best pairs atop a rotation.
A five-year deal would leave Hernandez just 28 when he would be eligible for free agency.
The native of Valencia, Venezuela, dubbed "King Felix" soon after he arrived in the major leagues, is 58-41 in 4 1/2 seasons. He has averaged 14 wins and 183 strikeouts in his four full seasons in the big leagues.