Transient pulsed radio emission from a magnetar