Munich to Barcelona, the closest major city in Spain, would take about 22 hours by train, if not a bit more, so you'll need to fly from Germany to somewhere in Spain. Spain, like Germany, is huge, with great destinations all over, so you'll have to be brutal in whittling down your itinerary. Don't forget that your arrival day (jetlag) and your departure day will not provide much serious sightseeing time, and something similar can be said for your shift-to-Spain day, by the time you deal with the airport rigamarole.
Barcelona needs quite a lot of time because of the number of sights and the need to pre-book most of the top ones (generally with timed tickets) because the ticket lines are so long. It is impossible to have a maximally efficient sightseeing schedule with a stack of timed entries, because you need to allow extra time alomg the way, not knowing how much time you'll want at each site. For this reason, I'd suggest five nights in Barcelona, more if you are nuts for modernista architecture or really want to overdose on the art museums.
The Oktoberfest drives up hotel prices in Munich, and availability is an issue as well. I suspect that it may also affect demand for flights in and out of the city (including to Barcelona), so it would be best to look into those arrangements ASAP.