The decision of sport's highest court was announced fewer than nine hours prior to the opening ceremony of the 23rd Winter Olympics, in Pyeongchang, South Korea.
CAS secretary general Matthieu Reeb appeared at a media conference to announce the decision, which he read out as a statement. Reeb did not take any questions.
The ruling related to two separate cases, one involving 32 athletes and another involving 15 individuals, 13 of them athletes, two of them coaches.
The CAS statement said: "In its decisions, the CAS arbitrators have considered that the process created by the IOC to establish an invitation list of Russian athletes to compete as Olympic Athletes from Russia (OAR) could not be described as a sanction but rather as an eligibility decision.
"Although the Russian Olympic Committee (ROC) was suspended, the IOC nevertheless chose to offer individual athletes the opportunity to participate in the Winter Games under prescribed conditions - a process that was designed to balance the IOC's interest in the global fight against doping and the interests of individual athletes from Russia."
The IOC in December determined that Russian athletes who proved they were clean would be allowed to compete as neutrals in the Games.
The Olympic Athletes of Russia (OAR) will compete under the Olympic flag and the Olympic anthem will be played at any medal ceremonies they feature in.
"We welcome this decision which supports the fight against doping and brings clarity for all athletes."
The OAR is the third largest delegation at the Games after the United States and Canada, with 168 athletes.
Among the athletes who were hoping to gatecrash the Olympics by forcing an invite through CAS were Victor Ahn and and Elena Nikitina.
South Korea-born Ahn is the most decorated short-track speedskater in Olympic history with six gold medals. He became a Russian citizen to represent the hosts at the Sochi Games.
Skeleton's Nikitina was stripped of her bronze medal from Sochi 2014.
Nikitina told TASS: "I'm very disappointed. I was hoping that CAS would take our side. I need to consult with lawyers."
The ruling is an endorsement of the IOC's procedures put in place in December following their own investigations into the systemic use of performance-enhancing drugs at the last Winter Games, held in Russia.
The CAS statement added: "The CAS panel found that the applicants did not demonstrate that the manner in which the two special commissions (the invitation review panel (IRP) and the Olympic Athlete from Russia implementation group (OAR IG)) independently evaluated the applicants was carried out in a discriminatory, arbitrary or unfair manner.
"The panel also concluded that there was no evidence the IRP or the OAR IG improperly exercised their discretion."
IOC spokesperson Mark Adams said: "We welcome this decision which supports the fight against doping and brings clarity for all athletes."
The World Anti-Doping Agency welcomed the CAS ruling.
WADA president Sir Craig Reedie said: "These decisions come as welcome news for WADA, as they will for athletes and all others worldwide that care for clean sport and the integrity of the Games.
"The timing of these decisions just before the opening ceremony in Pyeongchang is good as it will reassure athletes and others that only Russian athletes which have met strict anti-doping criteria will be participating in the Games."
Russian deputy prime minister Vitaly Mutko was scathing in his assessment telling TASS the CAS decision would "diminish competition and attention to the Games."
The IOC had been taking nothing for granted on Friday following a separate CAS ruling earlier this month which saw it defeated.
In December, the IOC banned 43 Russian athletes for life from the Olympics, but CAS overturned the suspensions of 28 athletes and partially upheld 11 other appeals - decisions IOC president Thomas Bach described as "extremely disappointing and surprising" last Sunday.
The IOC is considering an appeal against that decision.
DFS is proud to continue its support of Team GB as the official homeware partner, bringing the joy of comfort to Team GB athletes throughout 2018 and beyond.