The Battle of Gaines' Mill, sometimes known as the Battle of Chickahominy River, took place on June 27, 1862, in Hanover County, Virginia, as the third of the Seven Days Battles (Peninsula Campaign) of the American Civil War. Following the inconclusive Battle of Beaver Dam Creek (Mechanicsville) the previous day, Confederate General Robert E. Lee renewed his attacks against the right flank of the Union Army, relatively isolated on the northern side of the Chickahominy River. There, Brig. Gen. Fitz John Porter's V Corps had established a strong defensive line behind Boatswain's Swamp. Lee's force was destined to launch the largest Confederate attack of the war, about 57,000 men in six divisions. Porter's reinforced V Corps held fast for the afternoon as the Confederates attacked in a disjointed manner, first with the division of Maj. Gen. A.P. Hill, then Maj. Gen. Richard S. Ewell, suffering heavy casualties. The arrival of Maj. Gen. Stonewall Jackson's command was delayed, preventing the full concentration of Confederate force before Porter received some reinforcements from the VI Corps.
At dusk, the Confederates finally mounted a coordinated assault that broke Porter's line and drove his men back toward the Chickahominy River. The Federals retreated across the river during the night. The Confederates were too disorganized to pursue the main Union force. Gaines' Mill saved Richmond for the Confederacy in 1862; the tactical defeat there convinced Army of the Potomac commander Maj. Gen. George B. McClellan to abandon his advance on Richmond and begin a retreat to the James River. The battle occurred in almost the same location as the Battle of Cold Harbor nearly two years later.