The sanction was the toughest ever levelled by the IOC for drug cheating and came just 65 days ahead of the Games in Pyeongchang, South Korea.
In announcing the decision, IOC president Thomas Bach accused Russia of "perpetrating an unprecedented attack on the integrity of the Olympic Games and sport."
The Kremlin cautioned against an "emotional" response to the ban, as politicians and athletes reacted with anger and disappointment.
"The situation is serious, it calls for deep analysis and it would be wrong to give in to emotion here," President Vladimir Putin's spokesman Dmitry Peskov said.
An explosive report by the World Anti-doping Agency and two subsequent IOC investigations have confirmed that Russian athletes took part in an elaborate drug cheating program which peaked during the 2014 Winter Olympics in Sochi. Mounting evidence has indicated that the scheme involved senior government officials, including from the sports ministry, with help from secret state agents.
The IOC also banned Russia's Deputy Prime Minister Vitaly Mutko - who was sports minister during the Sochi Games - for life. Mutko is the head of the organizing committee for the 2018 football World Cup, which Russia is hosting.
The Russian Olympic Committee and its chief Alexander Zhukov were also suspended.
Zhukov said he "apologized" to the IOC for the "anti-doping violations" committed in his country in recent years.
Pyeongchang organizers said they would prefer if Russians competed under their own flag, but accepted as "second-best" the IOC ruling.
The IOC had the option of hitting Russia with a blanket ban, the so-called nuclear option that was applied to apartheid-era South Africa from 1964 to 1988.
The IOC's decision to choose a more moderate path offers Russian athletes a route to competing in the Games - although that will be by invitation only and dependent on a stringent testing program. Those athletes who do go to the Games will participate under the name "Olympic Athlete from Russia" and the country's flag will not fly at any 2018 ceremony, the IOC also said.
The US Olympic Committee praised the IOC's "strong and principled decision."