The Prime Minister of Spain, Mariano Rajoy, appeared in court as a witness on Wednesday morning, in an ongoing corruption investigation involving the illegal funding of his party, the Popular Party, several years ago when he was a minister under José María Aznar.

For two hours, Mr. Rajoy repeated before the court and lawyers that "I don't know", "I have absolutely no idea", or "I never knew anything about that", when probed on his involvement in the funding scheme under investigation.

The prime minister arrived by car to the back door of the court building and sat beside the judge and...