McNamara served as secretary of defence in the administrations of US presidents John F. Kennedy and Lyndon Johnson.
He also forged careers in industry and international finance, but was principally associated with the Vietnam War, the conflict dubbed "McNamara's war" by critics of the US operation.
'Failed US policy'
A controversial figure, McNamara was seen by many critics as the symbol of a failed US policy that led to the deaths of more than 58,000 US troops.
As defence secretary, McNamara oversaw the escalation of US military offensives in Vietnam from 1961 to 1968 and was also an early supporter of counter-insurgency operations.
McNamara was also a senior figure involved in the US invasion of the Bay of Pigs in Cuba in April 1961 and the Cuban missile crisis more than a year later during the Kennedy administration.
After leaving the US defence department in 1968, McNamara went on to head the World Bank until 1981.
He increased the bank's loans to developing countries and changed its focus from large-scale industrial projects to development in rural communities.
McNamara spent much of his life trying to explain the US role in Vietnam and apologising for his mistakes.
He also became a subject of the 2003 Academy Award winning documentary "The Fog of War", in which he discussed the difficulty of decision-making during the Vietnam war.
"We of the Kennedy and Johnson administrations acted according to what we thought were the principles and traditions of our country," McNamara, then 78, told the Associated Press news agency in an interview in 1995.
"But we were wrong. We were terribly wrong."