The 27-year-old singer takes on the 39-year-old Brooklyn Nine-Nine star, gobbles cookie dough and returns to the studio in the commercial for Taylor Swift NOW.
The ad follows a fictional day in Swift's life, including her "unbelievable choreographed fight sequence" with Samberg. The pair previously collaborated on a skit for a 2014 episode of Saturday Night Live.
"Such a taxing day when they're like 'eat some cookie dough' and you're like 'ok I'll make this sacrifice for my art,' Swift captioned a behind-the-scenes video from the commercial's shoot.
Taylor Swift NOW is a curated video catalog available to AT&T customers via the company's DirecTV Now streaming service.
Swift signed a multi-year deal with AT&T in October for future performances and content.
"We're thrilled to reach a deal to bring Taylor and her unique talents to her fans and our customers in new and exclusive ways," AT&T entertainment group CEO John Stankey said at the time.
Swift will release her sixth studio album, Reputation, on Nov. 10, which includes the single "Look What You Made Me Do."
Copyright 2017 United Press International, Inc. (UPI). Any reproduction, republication, redistribution and/or modification of any UPI content is expressly prohibited without UPI's prior written consent.