The win takes them to within two points of leaders Paris Saint-Germain at the top of Ligue 1.
Colombian international Rodriguez gave the visitors the lead after just five minutes when he bent an effort into the corner from close range following a quick counter-attack.
© Getty Images
Riviere doubled the lead on 23 minutes with a looping header from Anthony Martial's cross.
He then spurned a golden opportunity to make it three when he chipped over the bar when racing clean through before half time.
After the break Ranieri's side were content to see out the game, but Rodriguez
wasted a good chance when he lashed the ball well wide from around six yards out.
Ocampos added a late third when he took it around the keeper after Mathieu Bodmer was caught in possession on the edge of his box.