The Union Army of the James was formed in April 1864 under the command of Major General Benjamin Butler for the purpose of taking Richmond, Virginia and Petersburg, Virginia while the Union Army of the Potomac along with the separate IX Corps under the direction of Union General-in-chief Lieutenant General Ulysses S. Grant and the tactical command of Major General George Meade engaged Confederate General Robert E. Lee's Army of Northern Virginia in the Overland Campaign. In April 1864, the Army of the James was composed of the X Corps, the XVIII Corps and a cavalry division under the command of Brigadier General August V. Kautz. Butler failed to achieve his objectives in the Bermuda Hundred Campaign when his forces were stopped by a small Confederate force led by General P.G.T. Beauregard.
In December 1864, the white and black units of the Army of the James were divided into two corps. The black troops were sent to the XXV Corps; the white troops became the XXIV Corps, under the command of Edward O. Ord. The bulk of corps remained in the Petersburg trenches, but Adelbert Ames's second division took part in both Major General Butler's initial unsuccessful assault on Fort Fisher during the First Battle of Fort Fisher in December 1864 and the successful attack on the fort during the Second Battle of Fort Fisher the following January. This division was ultimately absorbed into the revived X Corps in March 1865.
The remainder of the corps served in the Petersburg Campaign. When Ord assumed command of the Army of the James from Butler on January 1, 1865, John Gibbon took command of the corps and led it ably. The corps took part in the defeat of Lee at Hatcher's Run in February and were involved in the assaults of Fort Gregg and Fort Whitworth during the fall of Petersburg on April 2 The corps was engaged during the skirmish at Appomattox that occurred just prior to Lee's surrender. During the Appomattox campaign, an Independent Division of troops that had served in the Shenandoah Valley was added to the first and third divisions. The corps remained in Virginia until August, when it was disbanded.