The People's Party won the most votes in the Spanish parliamentary elections, while the Socialist Party accepted defeat.