Barney was appointed a lieutenant in the Confederate States Navy on July 2, 1861. He commanded the CSS "Jamestown" during the Battle of Hampton Roads, the famous battle with the , during which he captured two brigs and an Accomac schooner off Newport News Point while the CSS "Virginia" held the Union Navy's attention. After the Confederate evacuation of Norfolk, the "Jamestown" was scuttled to block the James River at Drewry's Bluff. In the subsequent Battle of Drewry's Bluff, in which Confederate shore batteries drove off a Union Navy force heading towards Richmond, the "Jamestown"'s guns were considered the main factor in repulsing the enemy ships. Following the battle, he received praise from the Confederate Congress and was promoted to commander.