Giancarlo Gonzalez squandered Costa Rica's best chance, heading wide when unmarked in the 12th minute.
He has become the third player to score a free-kick in the World Cup thus far, following on from Aleksandr Golovin and Cristiano Ronaldo's excellent efforts.
Serbia, which missed out on the 2014 tournament, had the early advantage in a tough group that includes five-time champion Brazil and Switzerland.
"It's very important that we have these three points in the bag, but it's not over, Switzerland will be the hardest match". "The match against Switzerland is going to be the most hard one".
There was a late scuffle as Nemanja Matic tried to take the ball off a member of the Costa Rican staff on the sidelines, before a VAR red-card review saw Aleksandar Prijovic booked for a separate incident, but Serbia held on with relative ease for a potentially priceless win. It will be the first match of the tournament for both the teams. He was given a yellow.
Celebrating his 34th birthday in February, many would have forgiven former Chelsea defender Branislav Ivanovic for slowing down but against Costa Rica he showed no signs of doing so.
Mladen Krstajic's Serbia side - the lowest ranked European nation at Russian Federation 2018 - now appear the best placed of the two to progress after a dominant second-half display. Also included were Manchester United midfielder Matic, and Sergej Milinkovic-Savic, who had an apparent falling out with Muslin but was brought to Russian Federation by Krstajic.
The former Chelsea defender made his 104th worldwide appearance, surpassing the previous record of 103 which he held jointly with former midfielder Dejan Stankovic. Stankovic, known as "Deki", played for the national team from 1998-2013, through three different eras: Yugoslavia, Serbia-Montenegro and finally Serbia.
Bryan Oviedo will begin his FIFA World Cup campaign on Sunday when Costa Rica take on Serbia (KO 1pm). "Some of us are repeating, but there are teammates who are playing their first World Cup".
Costa Rica will play Brazil on June 22 at 6 am Costa Rica time. The goal wouldn't have counted, as Milinkovic-Savic was offside, but it was a attractive effort nonetheless.
His experienced side were solid throughout, with 23-year-old Lazio forward Sergej Milinkovic-Savic a constant threat.
Ramirez did his best to raise the spirits of the Ticos following the match, but he was also realistic. "I told the lads in the changing room "This isn't over".