Workday shares fell about 4 percent in extended trading on Tuesday, even though the cloud software company reported better-than-expected earnings for the fiscal second quarter, which ended July 31.

Here are the key numbers:

Earnings: 31 cents per share, excluding certain items, vs. 26 cents per share as expected by analysts, according to Thomson Reuters.

31 cents per share, excluding certain items, vs. 26 cents per share as expected by analysts, according to Thomson Reuters. Revenue: $671.7 million, vs. $663.1 million as expected by analysts, according to Thomson Reuters.

Revenue rose 28 percent from a year earlier, according to a statement, down from 29 percent growth in the prior period.

Most of Workday's revenue comes from subscriptions to its cloud services for human resources, finance and other business functions. In the quarter subscription revenue came in at $565.7 million, above the FactSet analyst consensus of $559 million.

The company reported sales in its professional services unit of $106.1 million, above the $104 million consensus.

Workday made its biggest acquisition yet in the quarter, buying Adaptive Insights, which provides cloud software for business planning, for $1.5 billion.

Workday expecting $721 million to $723 million in revenue for the fiscal third quarter, above the Thomson Reuters consensus of $691.2 million.

For the full 2019 fiscal year, Workday expects to hit $2.765 billion to $2.772 billion in revenue, topping the $2.704 billion FactSet consensus. The full-year estimate includes the contribution from Adaptive Insights.

The stock fell again in extended trading after chief financial officer Robynne Sisco provided the full guidance on Tuesday's call with analysts.

The company is expecting a lower margin -- down 300 basis points -- for the full fiscal year. That change is completely because of the Adaptive deal, Sisco said. "Approximately $40 million of this headwind comes from onetime transaction and integration cost with the remaining coming from ongoing operations," she said.

KeyBanc analysts raised their 12-month price target on Workday on Aug. 29, to $173 from $145.

"2018 is shaping up to be a breakout year for WDAY and a core growth holding for large-cap investors," they wrote. The analysts pointed to progress at universities, as well as wins with a few large companies.

Workday shares are up 54 percent this year, closing at a record $156.69 on Tuesday.

"We wouldn't be surprised to see a 'sell the news' reaction given the strong run-up in WDAY shares ahead of this report," Wedbush Securities managing director Steve Koenig told CNBC in an email.

-- CNBC's Josh Lipton contributed to this report.