Landon Donovan had a goal and an assist for the Galaxy (8-10-2), who handled the Timbers defense.
Portland (5-9-4) struggled in its first game since coach John Spencer was fired and Gavin Wilkinson took over the team.
Kris Boyd scored two goals for the Timbers, who lost for only the third time in 10 games at Jeld-Wen Field this season.
The Timbers took a 1-0 lead in the third minute when Boyd scored off a cross from Kalif Alhassan.
The Galaxy got their offense going in the 20th minute, when Beckham sent the ball into the back of the net.
Beckham gave the Galaxy a 2-1 lead when he sent a free kick past Portland keeper Troy Perkins in the 24th minute.
Donovan scored his seventh goal of the season on a penalty kick in the 26th minute and then passed to Keane for an easy goal in the 28th.
Kosuke Kimura cut the deficit to 4-2 when Galaxy keeper Josh Saunders bobbled a shot in the 35th minute.
Keane scored again in the 64th minute to make it 5-2. Boyd added a goal in the 70th minute for Portland.
The Galaxy are back in the playoff hunt and are in fifth place in the Western Conference. L.A. finishes its three-game road swing at Vancouver on Wednesday.