The one-year deal announced Tuesday is worth $3.25 million.
The 32-year-old Hernandez has pitched seven years in the majors, all with Cleveland. He was 0-3 with a 7.53 ERA last season.
Hernandez was arrested last winter in the Dominican Republic on false identity charges. They were dropped after he completed a work program. Major League Baseball later suspended him for three weeks. Hernandez sprained his right ankle in August and missed the rest of the year.
Hernandez is 53-69 with a 4.64 ERA in the majors. He was 19-8 with a 3.06 ERA in 2007 when Cleveland last made the playoffs.
Hernandez can earn performance bonuses with Tampa Bay as both a starter and reliever.