The Whitecaps appeared headed for a win that would have moved them into third place in the Western Conference, but Beckham started the comeback in the 81st minute with an assist from Landon Donovan.
Beckham then assisted on Villarreal's goal in the 87th minute, extending the Los Angeles unbeaten streak to three games.
Vancouver had taken a 2-0 lead at halftime on goals by Gershon Koffie and Barry Robson.
The Whitecaps (8-6-7) have lost at home just once this season.
Los Angeles (8-10-3) remained four points behind Vancouver in fifth place.