High-resolution spectroscopy of a surge in an emerging flux region