The former number one draft pick threw for 287 yards and three scores, while wide receivers Cooper Kupp and Odell Beckham Jr each caught a touchdown pass.
Stafford had plenty of protection and time to throw throughout the game, hitting Van Jefferson on a high-arching pass for a 52-yard touchdown which pushed the Rams 20-13 ahead early in the third quarter.
Kupp scored a four-yard touchdown minutes later.
Early in the fourth quarter, Arizona running back James Conner bulldozed through the Rams defence for an eight-yard touchdown to cut the score to 27-20 before Matt Gay kicked a 33-yard field goal to make it 30-20.
The Cardinals missed an opportunity to tie the game in the final seconds after a holding call wiped out a long run by quarterback Kyler Murray who finished the day with the unwelcome statistic of throwing two interceptions which led to Los Angeles scores.
The Cardinals’ (10-3) loss ensures they will have to wait at least a week before they can clinch their first play-off spot since 2015.
The Rams (9-4), meanwhile, looked rejuvenated after their second-straight win, pulling within one game of the Cardinals in the NFC West following a three-game losing streak in November.