First-half strikes by Stephan El Shaarawy and Patrik Schick, either side of a Juan Jesus own goal, moved Roma within three points of the top four but they had Alessandro Florenzi sent off with 10 minutes left while VAR denied Empoli a late equaliser.
Ranieri on Friday joined Roma until the end of the season after Eusebio Di Francesco was sacked in the wake of a 3-0 derby defeat by Lazio and a Champions League last 16 exit to Porto.
"I didn't expect us to play better, because this was a tense team that was anxious and still dealing with recent events," Ranieri told Italian broadcasters after the game.
"They (Roma) conceded most of their goals this season by playing out from the back, so I told them to adopt a safety first approach there.
"I do have some ideas on how to reduce the number of goals we concede, but I won't tell you what it is, otherwise that'll give it away.
"Let's say the leitmotif of my time here is to help Roma concede fewer goals, because it's just not possible for a team like this to leak that many goals. We have the quality to score sooner or later, so we must focus on not conceding."
Roma have conceded 37 goals in their 27 Serie A games this season -- by far the most in the top six -- and were under pressure to deliver a result under their new manager.
They got off to the perfect start when El Shaarawy curled his finish into the top corner after nine minutes.
Empoli were level three minutes later, though, when Jesus headed into his own net from a set piece before visiting captain Manuel Pasqual came close to turning the game on its head when his free-kick hit the angle between post and bar.
Roma restored their lead after 33 minutes when Schick rose to power home a header from Florenzi's free-kick.
Empoli had a one-man advantage after Florenzi was shown a second yellow card and they thought they had levelled through Rade Krunic's composed finish, only for the effort to be wiped out following a VAR review for a handball in the build-up.
The result keeps fifth-placed Roma in the hunt for the Champions League qualifying spots on 47 points behind fourth-placed Inter Milan, while Empoli remain in 17th place on 22 points, a point above the relegation zone.