In the quarter, Eli Lilly reported a net loss of $259.9 million, or 25 cents per share. After stripping special items like charges related to business development transactions, Lilly said it earned $1.55 billion, or $1.50 per share, eclipsing estimates from analysts polled by Thomson Reuters of $1.30 per share.
In the year-earlier quarter, Lilly's net income was $1.01 billion, or 95 cents per share.
Lilly posted revenue of $6.36 billion, up 9 percent from the year-ago quarter and above estimates of $6.05 billion.
Investors welcomed Lilly's decision to file an initial public offering for a less than 20 percent stake in its Elanco Animal Health unit, whose portfolio includes treatments for livestock and pets. Following the offering, Lilly plans to divest its remaining ownership through a tax-efficient transaction. The unit's sluggish sales had weighed on Lilly in previous quarters, prompting Lilly to perform a strategic review.
Lilly has approved a plan to buy back $8 billion in stock.
The company hiked its full-year adjusted earnings forecast to between $5.40 and $5.50 a share, up from the previous range of $5.10 to $5.20. Lilly's estimates reflect its decision not to increase U.S. list prices for the rest of the year, CEO Dave Ricks said in a statement.
Lilly joins a handful of other companies, including Pfizer and Novartis, that have pledged not to increase drug prices for the rest of the year in response to President Donald Trump's pressure. His administration unveiled a blueprint in May aimed at lowering drug prices. One of its architects, Secretary Alex Azar, was formerly an executive at Lilly.
"We're sensitive to the debate going on," Ricks told CNBC's "Squawk Box" on Tuesday. "We know consumers want us to restrain, and we really need to see what comes out of this blueprint, which is potentially a sweeping set of reforms that Secretary Azar and the administration's rolled out."
Correction: Eli Lilly plans to take public a less than 20 percent stake in its Elanco Animal Health unit. An earlier version incorrectly stated the company would hold a minority stake in the unit after the IPO.