The Argos-Shimano sprinter pipped experienced Australian Allan Davis (Orica-GreenEdge) in a tight bunch sprint at the conclusion of the largely flat 181.5km stage from Pamplona to Viana in northern Spain.
Britain's Ben Swift (Team Sky), the pre-stage favourite, had to settle for third place ahead of Italian Elia Viviani (Liquigas) after fading in the final 100 metres.
The victory was 23-year-old Degenkolb's sixth of the season - and the biggest of his career to date. It also gives the German the race's first green jersey as leader in the points classification.
Castroviejo finished comfortably in the peloton to conserve the red jersey he picked up after Movistar won Saturday's team time trial in Pamplona.
Played out in temperatures in the high 30s, the Vuelta's opening road stage was animated by an early four-man break involving danger man Niki Terpstra (Omega Pharma-QuickStep). Trailing the race lead by just 10 seconds after the TTT, Terpstra was persona non grata amongst the leaders - and the Dutchman soon dropped back into the peloton to give the break some chance of success.
Russian Mikhail Ignatiev (Katusha) and Spaniards Javier Aramendia (Caja Rural) and Javier Chacon (Andalucia) built up a maximum lead of five minutes over the peloton as the skies turned grey ahead of a quick downpour 30km from the finish.
Ignatiev took maximum points and bonus seconds at the two intermediate sprints while Chacon crossed the summit of the only climb of the day - the Cat.3 Alto de la Chapela - in pole position to secure the first blue polka dot jersey of the race as king of the mountains.
It was Chacon who first faltered, dropping back to the peloton after his work of the day was complete. The two other escapees were swept up with 12km remaining before Uzbek national champion Sergey Lagutin (Vacansoleil-DCM) put in an ambitious solo dig inside the final 6km.
Lagutin carved out a lead of 12 seconds over the peloton but was reeled in by the efforts of Orica-GreenEdge and the Australian team's Grand Tour debutant Daniel Teklehaimanot, the Eritrea national champion.
But it was the Argos-Shimano train that looked the most accomplished as the riders entered Viana after a long, straight and slightly uphill approach. Swift made the first move and was countered by Davis. But Degenkolb timed his surge to perfection to come through and take the first Grand Tour stage win of his career - much to the frustration of Davis, who banged his handlebars with his fist in anger.
Castroviejo, himself riding his maiden Grand Tour, leads four Movistar team-mates - including 2009 Vuelta champion Alejandro Valverde - at the top of the GC ahead of the race's first medium mountains stage.
Monday's undulating 155km stage three from the Faustino V winery to Eibar features three minor climbs ahead of a summit finish atop the Cat.1 Alto de Arrate. With the top ten on GC separated by just 10 slender seconds, the first major test of the 67th edition of the Vuelta should see an early selection made for the riders keen to make an impression on GC.