Academic success of students has been explained with a variety of individual and socioeconomic factors. Social networks that informally emerge within student communities can have an additional effect on their achievement. However, this effect of social ties is difficult to measure and quantify, because social networks are multidimensional and dynamically evolving within the educational context. We repeatedly surveyed a cohort of 226 engineering undergraduates between their first day at university and a crucial examination at the end of the academic year. We investigate how social networks emerge between previously unacquainted students and how integration in these networks explains academic success. Our study measures multiple important dimensions of social ties between students: their positive interactions, friendships, and studying relations. By using statistical models for dynamic network data, we are able to investigate the processes of social network formation in the cohort. We find that friendship ties informally evolve into studying relationships over the academic year. This process is crucial, as studying together with others, in turn, has a strong impact on students' success at the examination. The results are robust to individual differences in socioeconomic background factors and to various indirect measures of cognitive abilities, such as prior academic achievement and being perceived as smart by other students. The findings underline the importance of understanding social network dynamics in educational settings. They call for the creation of university environments promoting the development of positive relationships in pursuit of academic success.