Ayer mi amigo me sorprendió con una visita.
This sentence is grammatically correct.
The correct translation is: Yesterday my friend surprised me with a visit.
In the sentence there is a correct use of the past in the word "sorprendió" (surprised) that is in accordance with the time "ayer" (yesterday). In addition, it is correctly accentuated the word "sorprendió".