The European Court of Justice (ECJ) said "restrictive measures ... in response to the crisis in Ukraine against certain Russian undertakings, including Rosneft, are valid," Reuters reported.
With the ruling, the ECJ established its jurisdiction to rule on matters of the EU's common foreign and security policy, an area of fierce contention between Brussels and national governments seeking to maintain sovereignty.
Read alsoU.S. imposes sanctions against eight Russian companies – mediaThe EU slapped sanctions on Russia after it annexed Crimea from Ukraine in 2014 and stepped them up as Moscow went on to support separatists in Ukraine's industrial east.
Rosneft's head, Igor Sechin, is a close ally of Russian President Vladimir Putin.
A lawyer for Rosneft told reporters he was disappointed with the outcome.
"I would also say it is a setback for judicial protection in the EU in the area of sanctions because the court accepts (...) the fact that a company is partially state-owned is sufficient for it to be a target of sanctions," Lode van den Hende said.
The court said it believed encroaching on Rosneft's right to do business was in proportion with the severity of sanctions imposed on Russia over the Ukraine crisis.
"The Court holds that the importance of the objectives pursued by the contested acts is such as to justify certain operators being adversely affected," it said in its judgment.
Read alsoHow Russian companies bypass sanctions – mediaRosneft called the decision "illegal, baseless and politicized."
"The ruling shows that the rule of law in Europe is being replaced by the rule of political situation," it said in a statement.
"Rosneft continues to insist that it has not committed any illegal actions in any jurisdictions where it conducts its business, including Ukraine, and has nothing to do with the Ukrainian crisis."