The man attempted to kiss her neck and embrace her from behind, prompting Sheinbaum to gently push him away.
A government official quickly intervened, stepping between the president and the man before escorting Sheinbaum to safety.
State police later confirmed that the man involved in the incident had been arrested.
The event occurred during a week when the president had been addressing concerns about political violence, following the assassination of a mayor in Michoacan state.