Jeff Lawson, (C) Founder, CEO, & Chairman of Communications software provider Twilio Inc., takes a selfie photo during his company's IPO on the floor of the New York Stock Exchange (NYSE) in New York City, U.S., June 23, 2016.

Twilio soared to a new all-time high Tuesday after the cloud software company reported better-than-expected Q2 results and posted a profit earlier than expected.

Shares traded as high as $77.31 during the session, 22 percent higher than Monday's close, before closing 19 percent up at $75.05. That shoots the stock well ahead of its previous intraday high of $70.96 reached in September 2016.

The company reported earnings of 3 cents per share, excluding certain items — beating out analyst estimates of a 5 cents per share loss and Twilio's own guidance for the second quarter. Twilio also guided above Wall Street projections for the third quarter.

At least three Wall Street analysts raised their price targets for the company after the report.

The cloud company offers software for secure messaging platforms and competes with companies such as Avaya and Cisco.

At Tuesday's close, the stock was up more than 400 percent since going public in 2016. Shares have more than doubled in 2018.

— CNBC's Jordan Novet contributed to this report.