WATERTOWN, Mass. — Athenahealth Inc., a provider of online services to doctors and hospitals, said it is acquiring Epocrates Inc. for about $293 million to gain a leading iPhone app and expand in electronic records.

Athenahealth is based in Watertown, Mass., but has an office in Belfast.

Athenahealth will pay $11.75 a share for San Mateo, Calif.,-based Epocrates. The cash offer, which exceeded Epocrates’ Jan. 4 closing price by 22 percent, was approved by both companies’ boards, the company said.

The purchase will help Athenahealth, which processes insurance claims and patient payments, expand a newer business for software used to prescribe drugs and keep patient records. It may benefit from name recognition for the Epocrates app, which as of August was used by 338,000 U.S. physicians to call up summaries on drugs, including side effects and interactions. Athenahealth estimates about 90 percent of doctors had heard of Epocrates, three times the recognition of Athenahealth itself.

“Capturing mindshare has been an uphill battle for Athena for years, and the addition of Epocrates to the platform is a step in the right direction,” Greg Bolan, an analyst with Sterne Agee & Leach Inc. in Nashville, Tenn., said in an email.

Athenahealth expanded its operations to Belfast in November 2007, claiming it could employ as many as 700 people. It moved into the 130,000-square-foot complex originally built by MBNA.

As of March 2012, the company employed 400 in Belfast, but was looking to hire 80 more. At the time, the company was growing its Belfast workforce by 100 people a year, a company spokesperson told the Bangor Daily News.

Shares of Athenahealth rose 2.2 percent to $77.99 at the close of New York trading Monday. Epocrates surged 21 percent to $11.68.

The deal will add to Athenahealth’s earnings in 2013, said Chief Financial Officer Tim Adams. The company expects “limited growth, but respectable synergies” from combining the two, he said, declining to be more specific.

Epocrates will be run as a separate division under Athenahealth Chief Marketing Officer Robert Cosinuke, said Jonathan Bush, Athenahealth’s CEO and co-founder.

Epocrates was founded in 1998 to provide drug information to doctors using PalmPilots and rose to prominence on the iPhone soon after Apple’s App Store opened in 2008. Apple officials, including now-deceased CEO Steve Jobs, had highlighted Epocrates in speeches, and the application was voted the “Most Important Mobile Health-Care App” in December by readers of website ModernHealthcare.com.

“Our biggest obstacle is that 70 percent of doctors don’t even know we exist,” Bush said in an interview. “Epocrates is to health-care IT what Angry Birds is to games.”

Athenahealth will continue to use the Epocrates brand name and plans to integrate the app with its own electronic records system, athenaClinicals, the company said. That way, a doctor would be able to look up information on a drug and prescribe it.

Athenahealth’s software would automatically call the pharmacy, issue the insurance claim and handle other tasks.

Athenahealth also may expand Epocrates to include medical procedures such as blood tests or radiology, Bush said. A doctor could use the app to order an MRI and automatically see availability and insurance coverage of local clinics, he said.

Athenahealth’s sales have grown more than 30 percent a year since 2006 to about $423 million in 2012, according to analysts’ estimates compiled by Bloomberg. Epocrates had sales of about $110 million in 2012, according to the average estimate.

Larger rivals Allscripts Healthcare Solutions Inc. and Cerner Corp. sell software that medical groups run themselves. Athenahealth takes a different approach, running its software itself and selling the service.

Athenahealth’s main business of processing payments on patient visits and procedures has slowed to about 20 percent growth, Bolan, the Sterne Agee analyst, said. Handling electronic health records may help Athenahealth increase its billing to more than 5 percent of a doctor office’s annual revenue from about 4 percent, Bolan said. He estimates 7,300 doctors use Athenahealth’s electronic health records now.

Epocrates used its sudden iPhone fame to raise more than $86 million from investors in 2011, making it one of a handful of mobile app companies to have an initial public offering. While most doctors use a free version of the app, the company makes money by charging drug companies for sponsored links that doctors see when looking up medical information.

The company has struggled to move beyond that model. Epocrates invested in a short-lived attempt to build its own electronic health-records systems, which was canceled in early 2012 when the company brought in Andrew Hurd to be its third CEO since 2008.

BDN Business Editor Whit Richardson contributed to this report.