The analysis of the retinal vasculature represents a crucial stage in the diagnosis of several diseases. An exhaustive analysis involves segmenting the retinal vessels and classifying them into veins and arteries. In this work, we present an accurate approach, based on deep neural networks, for the joint segmentation and classification of the retinal veins and arteries from color fundus images. The presented approach decomposes this joint task into three related subtasks: the segmentation of arteries, veins and the whole vascular tree. The experiments performed show that our method achieves competitive results in the discrimination of arteries and veins, while clearly enhancing the segmentation of the different structures. Moreover, unlike other approaches, our method allows for the straightforward detection of vessel crossings, and preserves the continuity of the arterial and venous vascular trees at these locations.