The goddess of time gave him that ability, of course. The song of time has some power in Hyrule, but can't do a whole lot. But, in Termina, where the goddess of time watched over Link, it had much more power. Or the goddess of time gave it more power to help Link.
Oh, and it sends him back in...