(Reuters) - GrubHub Inc's revenue increased more than expected in the second quarter as a record number of people used its service to order meals online, sending the company's shares surging to a new year-high.

GrubHub's third-quarter revenue forecast also topped analysts' estimates, indicating the company may have got a handle on the rising competition from Amazon.com Inc's Prime Now and recent entrant Uber's [UBER.UL] UberEATS.

The company's shares rose as much as 27.8 percent to $39.29 in morning trading on Thursday and were the biggest gainer on the New York Stock Exchange on Thursday.

GrubHub, which serves more than 44,000 takeout restaurants in over 1,000 U.S. cities and London, said the number of active diners using its services rose 24 percent to 7.35 million in the second quarter ended June 30.

"Grubhub also generated a record number of orders in Q2 despite typical seasonal headwinds," said Chief Executive, Matt Maloney said in a statement.

The company's revenue rose to $120.2 million from $88 million in the quarter, topping analysts average estimate of $114.2 million, according to Thomson Reuters I/B/E/S.

Net income attributable to shareholders rose to $12.8 million, or 15 cents per share, from $9.4 million, or 11 cents per share, a year earlier.

The company forecast third-quarter revenue of $116 million-$119 million. Analysts on average were expecting $113.9 million.

(Reporting by Aishwarya Venugopal and Anya George Tharakan in Bengaluru; Editing by Savio D'Souza)