So I don't know anything about Spain specifically, but generally speaking as long as you have all the required documentation it should be fairly straight forward to sell you bike.
Now a few things to keep in mind:
1. Bike prices in Dubai are much higher than prices in Europe, so you might take a hit.
2. It might take some time to sell your bike, and if you want to sell it fast you might have to drop the price even lower.
Other that that sounds like a great trip.