On 12 May 2017, Hernández was included in the national squad that would play in the FIFA Confederations Cup in Russia. On 27 May, Hernández became Mexico's all-time top goalscorer with 47 goals when he scored in a friendly against Croatia. In Mexico's Confederations Cup debut, he scored Mexico's first goal in an eventual 2–2 draw against Portugal on 18 June, scoring a low header from a Carlos Vela cross.