Rookie Ryan Moats had 78 yards and a score on 12 carries for the Eagles (6-8), who ended a two-game skid.
Philadelphia, which entered the game losers of four straight on the road, will travel to Arizona next weekend before return home against Washington in the season finale.
McMahon finished 15-of-28 for just 97 yards and was intercepted three times. But the defense bailed him out with big stops on fourth down.
Ryan Fitzpatrick completed 10 of his 24 attempts for 69 yards with a touchdown pass and an interception for the Rams. The rookie threw a five-yard TD pass to Torry Holt, who ended with just three catches for 16 yards.
St. Louis (5-9) has lost three in a row.
Celebrity Breakups and divorces of 2014 [PHOTOS]