Beltran hit a homer in the third, his 19th of the season, and Lance Lynn struck out 12 over 7 1/3 to get the victory.
Lynn (10-2) joined R.A. Dickey of the New York Mets as the only 10-game winners in the major leagues this season. Dickey reached that total earlier Wednesday with a one-hit, complete-game effort against Tampa Bay.
Motte was called on in the ninth and allowed a leadoff single to Alejandro De Aza. Gordon Beckham advanced De Aza with a sacrifice and Dayan Viciedo reached on an infield single to put runners on first and third with one away.
The Cardinals snapped a two-game skid.
Jake Peavy (6-2) took the hard-luck loss after giving up only four hits and striking out six in seven innings.