Ruiz curled a delightful left-foot shot past Inter goalkeeper Daniele Padelli in the 57th minute after a one-two with right back Giovanni Di Lorenzo.
Inter lacked energy after Sunday's spectacular 4-2 comeback win against bitter city foes AC Milan in their league derby and Napoli bossed the midfield in the first half.
Dries Mertens fired over the bar with a first-time shot in the 16th minute and the visitors also came close on the stroke of halftime as Padelli denied Piotr Zielinski.
Tokyo 2020
Tokyo 2020 - Sweden vs Australia - Football - Olympic Highlights
However, Padelli was powerless when Ruiz unleashed a sublime effort which left the keeper clutching thin air.
A weary-looking Inter threw men forward in the closing stages but Napoli held out comfortably to gain the upper hand ahead of the return leg on March 5.
The home side missed their best chance to salvage a draw in stoppage time, when Napoli goalkeeper David Ospina smothered a close-range shot by substitute Danilo D'Ambrosio.
AC Milan host Juventus in the first leg of the other semi-final on Thursday, with the return scheduled for March 4. (Reporting by Zoran Milosavljevic; Editing by Ed Osmond)
Tokyo 2020
Sweden see off Australia to book Canada showdown
Braithwaite thought Eriksen 'was gone' after on-pitch heart attack