All perfect praise be to Allaah, The Lord of the worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and messenger.
If your journey to Spain is permissible like for studying or performing permissible work and the like, then you may break your fast in Ramadan and shorten the four Rak‘ah prayers while travelling. Eating at your home before leaving the houses of the village where you live is allowed by some scholars. However, many of them said that one may not break his fast until he began his journey by overstepping the last houses of his village.
Ibn Qudaamah said in Al-Mughni: "Whoever intends to travel should not shorten his prayers unless he leaves the last houses of his village and makes sure that they are behind him. This is the opinion of Maalik, Ash-Shaafi‘i, Al-Awzaa‘i, Is-haaq, Abu Thawr and it was narrated to have been adopted by a group of the Taabi‘oon . It was reported that ‘Ataa’ and Solymaan Ibn Moosa held it permissible to shorten prayers at home for whoever intended to travel. Al-Haarith Ibn Abi Rabee‘ah intended to travel so he led some people in his home in a two Rak‘ah prayer. These people included Al-Aswad Ibn Yazeed and more than one of the companions of ‘Abdullaah . ‘Ubayd Ibn Jabr said: ‘I was with Abu Basrah Al-Ghafaari in a ship in the month of Ramadan. The ship began to move and his meal was prepared. He did not overstep the houses when he ordered his meal and said: ‘Come on.’ I replied: ‘Do you not see the houses?’ Abu Basrah said: ‘Do you refrain from abiding by the Sunnah of the Messenger of Allaah ?’ So, he ate. This was narrated by Abu Daawood. Moreover, Allaah The Almighty Says (what means): {And when you travel throughout the land, there is no blame upon you for shortening the prayer.}[Quran 4:101] This means that one should have started his journey in order to shorten the prayers. It was narrated that the Prophet used to start shortening prayers when he left Al-Madeenah. Anas said: “I offered four Rak’ahs of Thuhr prayer with the Prophet at Al-Madeenah and two Rak‘ahs at Thul-Hulayfah (i.e. shortened the Asr prayer).” [Al-Bukhari and Muslim] Abu Basrah did not eat until the ship moved and the fact that 'he did not overstep the houses' means that they were not yet so far from them as ‘Ubayd told him: ‘Do you not see the houses?’ If that is known, then it is permissible for him to shorten prayers even if he is near the houses.”
Therefore, if you have eaten at your home after intending to travel out of following those who say that this is permissible from among the people of knowledge, then you are not sinful, Allaah Willing. However, it is preferable to act upon the opinion of the majority because it is safer. In any case, you should make up for the day in which you broke your fast during your journey.
Allaah Knows best.