The 33-year-old right-hander agreed to the deal last week subject to a physical, and the contract was announced Wednesday.
Hernandez can earn an additional $1.5 million in performance bonuses based on innings: $200,000 each for 140 and 155 innings, $300,000 for 170 and 185, and then $500,000 for 200.
Formerly known as Fausto Carmona, Hernandez was arrested in January 2012 on charges of falsifying his identity that were later dropped. Major League Baseball suspended him for three weeks.
He was 6-13 with a 4.89 ERA for Tampa Bay last season, and he is 59-82 with a 4.67 ERA in eight seasons overall, seven with the Cleveland Indians.
To clear a roster spot, the Phillies designated catcher Sebastian Valle for assignment.