Cooper, 44, joined Gaga, 32, as a surprise to the crowd.
"I even got you in-ears," the singer told him.
"Jackson never used these," Cooper said, referencing his "A Star Is Born" character Jackson Maine, who battled hearing loss and tinnitus in the film.
Gaga remained seated at the piano for the performance, wearing an oversized black T-shirt and a periwinkle wig.
During Gaga's solos, Cooper, who directed her in "A Star Is Born," gazed at her as he leaned over the piano before walking around the stage to rile up the crowd.
He later sat with her at the piano with his arm around her for the conclusion of the song.
It was the first time the duo performed "Shallow" live outside of their actual filming of the movie.
Cooper and Gaga got Oscar nominations for Best Original Song for "Shallow" and Best Original Score for "A Star Is Born."
They are slated to perform "Shallow" at the awards, which will air Feb. 24 on ABC.
Cooper is also nominated for Best Adapted Screenplay and Best Actor, while Gaga got a nod for Best Actress.