The deal illustrates how providers of commoditised banking services are seeking to diversify by developing or acquiring technology that powers transactions such as credit card purchases and payments through a mobile phone.

Fiserv, one of the biggest technology providers to banks by revenue, said in a statement the acquisition enables it to offer services to financial clients, from enrolling new customers to providing multiple ways to handle physical or digital payments.

In an interview, Fiserv President and Chief Executive Jeffery Yabuki said the deal combines "the largest, broadest and best processor of card-based payments" with his firm's expertise in other areas of payments, such as bank transfers.

First Data's low valuation compared to that of its rivals also gave Fiserv confidence to pursue the deal, a source familiar with the matter said. First Data trades at a price-to-earnings ratio of 14.83 times, compared with 56.25 for Global Payments Inc and 30 for Euronet Worldwide Inc, according to Refinitiv data.

Despite its strong market position for payments, especially in the United States, First Data has been weighed down by heavy debts from a $29 billion leveraged buyout led by private equity firm KKR & Co Inc in 2007.

First Data became publicly traded again in 2015, although its share performance has lagged since then, despite efforts by First Data Chief Executive Frank Bisignano, a former top JPMorgan Chase & Co executive, to reduce leverage levels.

"It's not about timing but more securing a strategic combination that's unparalleled," Bisignano said in an interview, when asked why the company had sold itself before the deleveraging programme was complete.

KKR, owner of 39 percent of First Data's common stock, will hold 16 percent of the combined company and receive a board seat.

Fiserv said it had secured debt to refinance First Data's existing $17 billion of obligations, and planned to return to its historical leverage levels within 24 months after the deal closes.

Fiserv will offer $22.74 for each First Data share, a premium of nearly 30 percent over Tuesday's closing price.

After the deal's expected closing in the second half of 2019, Fiserv shareholders will own 57.5 percent of the combined company and First Data shareholders the rest.

First Data's shares closed 20.7 percent higher at $21.17, while Fiserv's fell 3.8 percent.

Yabuki will become CEO and chairman of the combined company, while Bisignano will be chief operating officer.

JPMorgan Chase acted as financial adviser to Fiserv, and Bank of America Corp represented First Data. The companies' respective legal advisors were Sullivan & Cromwell and Simpson Thacher & Bartlett.

(Additional reporting by Liana B. Baker in New York; Siddharth Cavale and Supantha Mukherjee and Munsif Vengattil in Bengaluru; Editing by Arun Koyyur, Patrick Graham and Richard Chang)

By Siddharth Cavale and David French