EBay Inc (EBAY) posted a 13 percent rise in quarterly revenue on Wednesday, as it fended off increasing competition from arch-foe Amazon.com Inc and a growing number of smaller niche retail websites.

The company reported second-quarter revenue of $4.37 billion, versus $3.88 billion a year ago and the $4.38 billion that Wall Street had expected, on average.

Gross merchandise value, a measure of ecommerce transactions across its main Marketplaces platform, grew 12 percent, in line with or slightly better than analysts' forecasts.

Shares in eBay inched 1.3 percent higher to $51.35 after hours, from a close at $50.70 on the Nasdaq.

Ebay's stock has fallen more than 8 percent since April, hurt by a cyber-attack disclosed in May that compromised data for some 145 million customers, the departure of the highly regarded chief of PayPal, its fastest-growing division, and intensifying competition from both online and offline rivals.

Apart from Amazon, physical retailers are investing to boost their online presence and eBay has to fend off a growing coterie of fast-growing retail upstarts that focus on specific categories such as home and apparel.

On Wednesday, eBay forecast third-quarter revenue of $4.3 billion to $4.4 billion, compared with expectations for $4.4 billion according to Thomson Reuters I/B/E/S.

For the second quarter, it posted non-GAAP earnings per share of 69 cents, a penny better than the average Street forecast for 68 cents.

(Reporting by Edwin Chan; Editing by Richard Chang)