The 23-year-old was an unexpected success in his debut season at the club, as he scored 20 goals in all competitions.
Now, the Mexican forward is expected to be among the club's highest earners after putting pen to paper on the extension.
"We have renegotiated Javier's contract and he is now committed for five years with Manchester United," said Hernandez's agent, Eduardo Hernandez.
"The initial contract was good for Manchester and for Javier because it enabled them both to see if they could fit together and if he could achieve what was expected of him. Both sides have met their expectations and United were happy to reward Javier after his very good performances last season.
"Javier was not badly paid with his initial contract, but it was his first contract and, with respect, not comparable with the likes of Wayne Rooney and Nani. But today I can say that the contract has just been signed and everyone is satisfied."
The news comes after Tom Cleverley was recently offered improved terms.