Deutsche Boerse, which is flush with cash, has been eagerly seeking out deals under Chief Executive Officer Theodor Weimer, who has made mergers and acquisitions a pillar of his strategy.
The 51% stake for 389 million Swiss francs (309.3 million pounds) leaves UBS with a 49% minority stake, Deutsche Boerse said.
As part of the deal, Clearstream - Deutsche Boerse's post-trade service provider - and UBS have agreed to a long-term cooperation to provide services to UBS.
The transaction is expected to close in the second half of the year.
(Reporting by Michael Shields in Zurich and Tom Sims in Frankfurt; editing by Brenna Hughes Neghaiwi and Michelle Martin)