Murray was born in Pittsburgh, Pennsylvania, and was entered the Navy as a midshipman on August 22, 1835. He served aboard the schooner Grampus in the West Indies Squadron in 1836-38, and on the steamer Poinsett off the Atlantic coast in 1839-41, receiving promotion to passed midshipman on June 22, 1841.
He then served on the sloop Vincennes in the Home Squadron in 1841-43, and the schooner Shark in the Pacific Squadron in 1844-45. He returned to the Home Squadron in 1846, to participate in the capture of Alvarado, Tabasco, Tuxpan, Veracruz, and Tampico during the Mexican War.
Murray then served in the Coast Survey in 1846-49, and was promoted to master on March 23, 1847, and received his commission as lieutenant on August 12, 1847.
Murray served aboard the razee Independence in the Mediterranean Squadron in 1849-51, and was stationed on the receiving ship at Norfolk in 1852-53. He was placed on the Reserved List on September 13, 1855, not returning to Active status until August 12, 1857. Murray then served on the Coast Survey in 1858-60.
At the start of the Civil War Murray was given command of the screw steamer Louisiana and assigned to the North Atlantic Blockading Squadron. Louisiana operated along the coast of Virginia, blocking the passage of Confederate blockade runners, and attacking their bases. On 13 September 1861, Louisiana and the frigate Savannah engaged the Confederate steamer CSS Patrick Henry off Newport News, but shot from both sides fell short.
In early 1862 Louisiana was part of the naval forces supporting Ambrose Burnside's North Carolina Expedition, and Murray saw action at a series of battles; at Roanoke Island on February 8, Elizabeth City on February 10, and New Bern on February 14.
In May 1862 Murray commanded a combined Army-Navy operation on Virginia's York and Pamunkey Rivers, destroying twenty-seven enemy vessels, including two large steamers, and approaching to within 11 miles (18 km) of Richmond, the capital of the Confederacy. He was promoted to commander on July 16, 1862, and was assigned to duty in the Sounds of North Carolina in 1863. He was then stationed at Portsmouth Navy Yard, New Hampshire, until the end of the war.
Murray was appointed to command of the steamer Augusta on April 2, 1866, and was promoted to captain on July 25. In May 1866, Augusta embarked Gustavus Fox, the Assistant Secretary of the Navy, and sailed on a cruise, accompanied by the monitor Miantonomoh and the gunboat Ashuelot. The purpose of the cruise was threefold; firstly to convey Fox to Russia as President Andrew Johnson's personal representative to Tsar Alexander II, secondly to demonstrate the monitor's ability to operate in the open sea, and thirdly to cultivate friendly international relations. After the three ships arrived at Queenstown, Ireland, Ashuelot sailed independently to the Far East, and Augusta and Miantonomoh then visited England, before finally arriving at Kronstadt in August. After a month's stay in Russia, during which the Tsar and members of the royal family visited the ships, they called at Stockholm, Sweden, Kiel, Germany, and ports in France, Portugal, and Spain. After transiting the Strait of Gibraltar, the ships spent Christmas at Málaga, Spain, before spending the next four and a half months visiting ports in the Mediterranean Sea. They returned home via the Canary Islands, the Cape Verdes, Barbados, and the Bahamas, finally arriving at Philadelphia on 22 July 1867.
Murray then served as commandant of the Philadelphia Navy Yard in 1869. He was promoted to commodore on June 19, 1871, and to rear admiral, on April 26, 1876, and served on the Lighthouse Board, and commanded the Pacific Station. Murray was placed on the Retired List on April 30, 1878.
Murray was a companion of the Military Order of the Loyal Legion of the United States.
Rear Admiral Murray died on November 10, 1884 in Washington, D.C.Two ships, USS Murray (DD-97) and (DD-576) were named for him and his grandfather, Commodore Alexander Murray