Germany's SAP AG said it plans to buy smaller business software maker Sybase Inc for $5.8 billion, gaining technology that allows it to deliver its programs to mobile devices like the iPhone.

Wednesday's move is likely to escalate competition between SAP and larger rival Oracle Corp , which is the world's top maker of databases but which ranks second in the business management software market behind SAP.

California-based Sybase sells programs that make it easy for workers to access business software via smartphones and other mobile devices. SAP already uses the technology to let customers access its applications when they are on the road.

We want to make sure SAP solutions can be accessed from all leading mobile devices. The acquisition of Sybase will allow us and our partners to do just that, Jim Hagemann Snabe, SAP's co-chief executive said in a conference call.

SAP has signed a definitive agreement to pay $65 per share in cash for Sybase, which is the world's No. 4 provider of database software, the company said. That represents a 44 percent premium to company's three-month average stock price.

Sybase shares rose to $64.52 in after-hours trade. They had climbed 35 percent to $56.14 on the New York Stock Exchange after Bloomberg first reported that SAP was planning to buy Sybase.

SAP said that it would fund the deal with cash on hand and a 2.75 billion euro loan facility.

The companies said they expect the transaction to close during the third quarter immediately adding to SAP's earnings.

SAP's U.S. shares edged lower in extended trade to $44.50 from their close of $44.90.

Deutsche Bank and Barclays advised SAP, while Bank of America Merrill Lynch advised Sybase.

(Reporting by Jim Finkle. Editing by Robert MacMillan, Leslie Gevirtz)