A repost with some revisions.
Cinco de Mayo celebrates the battle of Puebla on May 5, 1862, in which Mexican soldiers, facing a much larger French army, achieved victory. It is not to be confused with Mexico's Independence Day, which is September 16; Mexican independence from Spain was achieved almost fifty years before the battle of Puebla. During the administration of Mexican president Benito Juarez, Napoleon III had sent an army, under the pretext of debt collection, to establish French rule in Mexico under the viceroy Maximilian. It was a bold plan, but the odds dramatically favored Napoleon III: the French army was one of the finest in the world at that time, and the United States, who given the chance would certainly have opposed the French incursion and assisted the Mexicans (as they would later), was embroiled in the Civil War. The French smashed through the initial Mexican defenses.
Operating under the assumption that the Mexicans would capitulate if their capital were to fall, the French set out to attack Mexico City. The Mexican army, under the leadership of Texas-born Ignacio Zaragoza (Texas, of course, was at the time of his birth still part of Mexico; Zaragoza was born in Goliad and moved with his family to Mexico after Texas independence), retreated to the fortified city of Puebla. When the French arrived, they sent their cavalry out to the French flanks; the French army made the mistake of sending its own cavalry to chase them. The Mexican cavalry was easily able to tie up the French cavalry, thus forcing the French infantry to charge the Mexican infantry unassisted. The ground was muddy from rain, making it difficult to maneuver. It is also sometimes said that the Mexicans stampeded large herds of cattle against the French; which, if true, would have no doubt been a bit disconcerting. In any case, the French were eventually forced to retreat from Puebla. Against enormous odds, the Mexicans had won the battle.
But they lost the war. The French naturally brought in reinforcements and nothing could really stop them from seizing control of Mexico. Juarez was sent into hiding, where he organized the resistance. Maximilian ruled until 1867, when he was executed by troops loyal to Juarez.
Cinco do Mayo is celebrated in Mexico, but except for perhaps Puebla and the surrounding areas, it is not even close to being as popular as it is in the U.S., where it is perhaps second only to St. Patrick's Day as the most widely celebrated ethnic holiday.