(Adds data, background)
OTTAWA, Aug 31 (Reuters) - Canada's current account deficit narrowed slightly in the second quarter of 2015 to C$17.40 billion ($13.18 billion) on more favorable trade in goods and services, Statistics Canada said on Monday.
The deficit was greater than the C$16.90 billion shortfall predicted by analysts. Statscan revised the first quarter deficit up to C$18.15 billion - the second highest on record - from an initial C$17.47 billion.
A strong gain in exports in June helped trim the trade in goods deficit to C$6.74 billion from C$7.07 billion in the first quarter.
Overall exports of goods edged up C$680 million to C$128.83 billion, largely due to higher prices. Total imports of goods rose by C$350 million to C$135.57 billion, in part due to higher shipments of motor vehicles and parts.
The deficit on trade in services shrank by C$240 million to C$5.49 billion as non-residents increased their spending in Canada. This reflected the higher number of foreign travelers, Statscan said.
The deficit on cross-border investment income flows dropped to C$4.00 billion from C$4.19 billion as earnings by Canadian investors on their holdings of foreign securities advanced for the 11th successive quarter.
$1=$1.32 Canadian Reporting by David Ljunggren Editing by W Simon