South Korea returned to a trade surplus in June after 15 consecutive months of deficits, as a decline in exports moderated significantly.