AFP reports citing authorities.
The storm was later downgraded to a tropical storm with maximum sustained winds of 96 kilometers (60 miles) per hour, the US National Hurricane Center said.
It had made landfall in the state of Chiapas, a rural region with archeological sites near the neighboring state of Oaxaca. Hundreds of people were being evacuated from affected areas in Chiapas, state civil protection officials said.
The US man "was dragged by the waves and died" after he ignored a ban on entering the beach in the town of Salina Cruz in Oaxaca, state civil protection director Manuel Maza told AFP.
The second victim was a 27-year-old man who was swept away by an overflowing river in the Oaxaca town of Pinotepa Nacional, Mayor Carlos Sarabia said.
In the state of Guerrero, heavy rains flooded some streets of the resort city of Acapulco, with water levels reaching 52 centimeters (20 inches) and sweeping away at least three cars, an AFP correspondent said.
Oaxaca authorities had urged residents to stay home, while the ports of Salina Cruz, Huatulco, Puerto Angel and Puerto Escondido were shut down. Some 200 families were taken to shelters, officials said.
Barbara grew into a category one hurricane -- the lowest on the five-level Saffir-Simpson scale -- before making landfall west of the Chiapas town of Tonala, the US hurricane center said.
In its OO00 GMT Thursday bulletin, the center predicted a "rapid weakening" of the storm and that Barbara would "dissipate within the next day or so."
Mexico's National Water Commission warned that Barbara's winds could affect the neighboring states of Chiapas, Tabasco, Campeche, Yucatan, Quintana Roo, Veracruz and Guerrero.
The storm was moving toward the northeast at 14 kilometers per hour, the US hurricane center said. Tropical force winds extend outward up to 113 kilometers from the storm's center.
Barbara was forecast to dump up to 25 centimeters of rain over eastern Oaxaca and western Chiapas, with as much as 50 centimeters possibly falling in isolated areas of southeastern Oaxaca, the center said.
"These rains could cause life-threatening flash floods and mudslides," it warned.
In March 2012, two girls died and 25,000 homes were affected when Hurricane Carlotta tore across Oaxaca.