The defeat capped a tumultuous and emotional day for Philadelphia. Charlie Manuel, the winningest manager in club history, was fired earlier in the day by general manager Ruben Amaro Jr., who broke down when delivering the news.
Sandberg, the Hall of Famer and former Cubs second baseman, was promoted from third base coach to interim manager. But the Phillies, who have lost 20 of 24, didn't play any differently for Sandberg.
The Dodgers didn't play any differently, either.
Ramirez's two-run homer in the fourth was all the offense Greinke (11-3) needed to lead Los Angeles to its season-best ninth straight win and 18th victory in its last 19 road games. The Dodgers are 41-8 since June 22.
Greinke won his third straight while outpitching Cliff Lee (10-6) in a matchup of former AL Cy Young Award winners. The right-hander struck out three and walked four.
Lee, who entered 0-3 with a 5.63 ERA in his last four starts, looked more like the $120 million pitcher he is by tossing eight strong innings. He allowed three runs on five hits with six strikeouts and one walk.
Ramirez had one of those hits, a drive to left in the fourth that put Los Angeles ahead 2-0. He is 8 for 16 with three homers against Lee.
The Dodgers added a run in the seventh on Mark Ellis' double and another in the ninth on Scott Van Slyke's single.
The Phillies, as has been the case for most of the second half, had no answer. Sandberg questioned the team's focus before the game, calling its play "lackadaisical" at times lately. Philadelphia's batters appeared to be trying, but they couldn't produce runs off Greinke or three Dodgers relievers.
The Phillies finished with just three hits while being shut out for the 11th time.
They threatened in the eighth, loading the bases with two outs before Ronald Belisario struck out Darin Ruf.
It's been that kind of season for Philadelphia, especially lately.
Manuel paid for it.
The 69-year-old skipper was in the final year of his contract and wanted to manage another two or three seasons.
"I never quit nothing and I didn't resign," Manuel said, making it clear he was pushed out the door.
Phillies fans responded to the news by bringing impromptu signs to the game thanking Manuel for his tenure. One of the loudest cheers of the evening went to a young boy shown on the electronic scoreboard wearing a T-shirt that read: "Thanks Charlie. I'll Miss You."
Sandberg managed the Phillies' Triple-A team at Lehigh Valley the previous two seasons. He was part of one of the most lopsided trades in baseball history when the Phillies traded him and Larry Bowa to the Cubs for shortstop Ivan DeJesus in 1982.
Amaro said Sandberg takes over on an interim basis and would be evaluated after the season. Sandberg inherited a team that entered Friday 20½ games out of first place in the NL East.
"These guys are professional players, they're getting paid well," Sandberg said. "Sometimes players have to dig deeper, play with pride, play with heart and for the name on the front of the uniform."
Manuel won his 1,000th game as a manager on Monday in Atlanta. Two days later, he sat in the dugout knowing it would be his last game after Amaro informed him of the decision not to extend his contract. The Phillies had planned to honor Manuel on Friday by presenting him with a base signed by every member of the team. Those plans were canceled.
Manuel led Philadelphia to the franchise's second World Series title in 2008 and brought the team back to the Series in 2009, when the Phillies lost to the Yankees in six games.
Manuel was 780-636 with the Phillies and won five straight NL East titles from 2007-11. He also spent three years as manager of the Cleveland Indians, winning the AL Central in 2001.