McNamara, who served under presidents John F Kennedy and Lyndon B Johnson, was also an architect of the US policy of nuclear deterrence.
He had suffered failing health for some time and died in his sleep at his home in Washington, his wife Diana said. After retiring in 1981, he championed the cause of nuclear disarmament.
Before taking up the post of US Secretary of Defence in 1961, Mr McNamara was the president of Ford Motor Company, turning the company around the post World War II era.
He is most closely associated with overseeing the escalation of the US war in Vietnam from 1961 to 1968.
However, in his 1995 memoirs In Retrospect: The Tragedies and Lessons of Vietnam, he wrote of his regret over his Vietnam role.