Prince Joachim, 28, travelled from Belgium to Spain for an internship on 26 May, the palace said.
Two days later, he went to a party in the southern city of Córdoba, before testing positive for Covid-19.
Spanish reports suggest the prince, a nephew of Belgium's King Philippe, was among 27 people at the party.
Under Córdoba's lockdown rules, a party of this size would be a breach of regulations, as gatherings of no more than 15 people are currently permitted.