Sergi Roberto slid home the hosts’ opener from Jordi Alba’s cross after only 99 seconds.
Sandro levelled for Getafe after a one-two with Carles Alena, both former Barcelona players.
But Depay showed good skill from Frenkie de Jong’s pass before rifling into the bottom corner after half an hour for the winner in front of about 26,000 fans.
It was the first La Liga goal scored and assisted by a Dutch player since 2009.
Barcelona – who brought on 17-year-old Gavi for a second-half debut – remain unbeaten on seven points from three games. Getafe have lost all their matches.
There was a return from injury for Barca keeper Marc-Andre ter Stegen, who missed the opening two weeks after knee surgery.
Ronald Koeman’s Barca were far from convincing but could have won by more, with Ronald Araujo having a goal ruled out for offside and Depay volleying over.