After Biloxi's 2015 season ended, the Brewers promoted López to the major leagues.[4] He made his major league debut on September 29, 2015.[6] In 2016, López began the season with the Colorado Springs Sky Sox of the Triple–APacific Coast League, but struggled, pitching to a 6.81 ERA in 17 games started. He was demoted to Biloxi.[7] López pitched for the Puerto Rican national baseball team in the 2017 World Baseball Classic. In the 2017 season, López returned to Biloxi. He pitched to a 4.61 ERA as a starting pitcher, and then became a relief pitcher, and had a 3.62 ERA in that role. He made one appearance for the Brewers in 2017, pitching two innings and allowing one run on four hits on June 29.[8]
During the 2017–18 offseason, López pitched for the Águilas Cibaeñas of the Dominican Professional Baseball League.[8] López began the 2018 season with Colorado Springs. The Brewers again promoted him to the major leagues on April 11.[9] He made one appearance, on April 16, before being returned to Colorado Springs on April 17.[10]
On July 27, 2018, López, along with teammate Brett Phillips, was traded to the Kansas City Royals for Mike Moustakas.[11] On September 8, in his seventh major league start, López flirted with a perfect game as he retired 24 consecutive Minnesota Twins batters in order over eight innings.[12] In the ninth inning, López surrendered a leadoff walk to Max Kepler and a hit to Robbie Grossman before walking off the mound at Target Field to a standing ovation. He became the first pitcher in Royals history to bring a perfect game into the ninth inning, besting Bret Saberhagen's seven-inning attempt vs. the Seattle Mariners. He was designated for assignment on August 7, 2020.
On August 9, 2020, the Baltimore Orioles claimed López off of waivers.[13] López ended the 2020 season with a 6.69 ERA and 28 strikeouts to partner with a 2–2 record over 10 appearances.[citation needed] On August 21, 2021, after going 3–14 with a 6.35 ERA in 25 starts, Lopez was moved to the bullpen.[14]
In 2022, the Orioles shifted López into the closer role and he collected his first save on April 11 in the Orioles 2–0 win against the Brewers.[citation needed] After pitching to a 1.62 ERA with 17 saves in 40 games during the first half of the season,[15] López represented the Orioles at the 2022 Major League Baseball All-Star Game.[16]
On August 2, 2022, the Orioles traded López to the Minnesota Twins in exchange for minor league pitching prospects Cade Povich, Yennier Canó, Juan Nunez, and Juan Rojas.[17]
On January 13, 2023, López agreed to a one-year, $3.525 million contract with the Twins, avoiding salary arbitration.[18]
On July 26, 2023, López was traded to the Miami Marlins in exchange for Dylan Floro.[19] In 12 appearances for the Marlins, he struggled immensely to a 9.26 ERA with 8 strikeouts in 11+2⁄3 innings pitched. On September 2, he was optioned to the Triple–A Jacksonville Jumbo Shrimp after Johnny Cueto was activated from the injured list.[20]
On September 2, 2023, López was claimed off waivers by the Baltimore Orioles.[21][22] In 12 appearances for Baltimore, he posted a 5.25 ERA with 14 strikeouts in 12 innings pitched. On September 30, López was designated for assignment by the Orioles.[23] He cleared waivers and elected free agency on October 5, 2023.[24]
On December 14, 2023, López signed a one-year contract with the New York Mets.[25][26] In 28 games for the Mets, he compiled a 3.76 ERA with 19 strikeouts across 26+1⁄3 innings pitched. On May 29, 2024, López was ejected in the eighth inning of a lopsided loss to the Los Angeles Dodgers by the third base umpire. Walking off the field, he threw his glove into the stands, untucked his shirt. In a postgame interview, Lopez seemingly called the Mets “the worst team in all of f—- MLB.”[27] However, he clarified after being misheard, stating he was "the worst teammate on the worst team in baseball."[28] López was designated for assignment by the Mets the next day.[29] On June 5, he was released by the team.[30]
On June 11, 2024, López signed a minor league contract with the Chicago Cubs.[31] He made three scoreless appearances for the Triple–A Iowa Cubs, striking out one batter in 2+2⁄3 innings. On June 28, the Cubs selected López's contract, adding him to their major league roster.[32]