On April 24, 2006, President George W. Bush nominated Gelpí to a seat on the District of Puerto Rico vacated by Hector M. Laffitte, who assumed senior status on November 15, 2005. Gelpí was confirmed by voice vote on July 20, 2006, and received his judicial commission on August 1, 2006.[3] He served as Chief Judge from April 13, 2018, to October 20, 2021.[4] His service as a district court judge was terminated on October 20, 2021, when he was elevated to the court of appeals.[3]
On May 12, 2021, President Joe Biden nominated Gelpí to be a United States circuit judge for the First Circuit,[6][7] to the seat vacated by Judge Juan R. Torruella, who died on October 26, 2020.[8] On June 23, 2021, a hearing on his nomination was held before the Senate Judiciary Committee.[9] During his confirmation hearing, Republican senators criticized Gelpí over his critique of the insular cases that established Puerto Rico's rights.[10] On July 22, 2021, his nomination was reported out of committee by a 12–10 vote.[11] On October 7, 2021, Majority Leader Chuck Schumer filed cloture on his nomination.[12] Later that day, the United States Senate invoked cloture on his nomination by a 54–39 vote.[13] On October 18, 2021, Gelpí was confirmed by a 52–41 vote.[14] He received his judicial commission on October 19, 2021.[3] He is the second judge of Hispanic origin to serve on the United States Court of Appeals for the First Circuit and the second judge from Puerto Rico ever to sit on the First Circuit.[15]