The Second Battle of Cancha Rayada (March 16, 1818), (also known as the Surprise of Cancha Rayada) was fought in Chile between South American rebels and Spanish royalists, during the South American wars of independence. The result was a huge defeat for the rebels, who took their revenge at the Battle of Maipú.
Knowing their disadvantage in number and cavalry, the Spanish General Osorio was not eager to engage in battle either, remaining content with fortifying Talca. However, after a suggestion from Colonel José Ordóñez a confrontation was decided upon, under Ordoñez' command.
In an uncharacteristic move, instead of ordering retreat San Martín held the position, which made more patriot soldiers flee under enemy fire, leaving their weapons and supplies behind. After the initial disorder, however, he ordered retreat. The rear and reserves had already re-positioned, somewhat withstanding the attack, but had no-one in command, since their chief, Colonel Hilarión de la Quintana, had left for headquarters to receive orders after the re-position and had not yet returned. Colonel Juan Gregorio de Las Heras took command, and led the men during the retreat, while trying to recover as much artillery and weapons as possible. San Martín and O'Higgins (who were also retreating at full speed) were being closely chased by royalist forces.
The battle (which was the only defeat the campaign had suffered) resulted in around 150 killed, and two hundred men taken prisoner. Several hundred had deserted, the whole artillery of the Argentine side was lost along with considerable amounts of horses, mules and weapons from both the Chilean and Argentine parts of the army. Despite the royalist victory, the action proved decimating to their side: two hundred soldiers had been killed, three hundred men captured and around six hundred had deserted, a total comprising more than half the two thousand men that had charged into the battle.