The early development literature documented that the growth path of most advanced economies was accompanied by a process of structural transformation. As economies develop, the share of agriculture in employment falls and workers migrate to cities to find employment in the industrial and service sectors [Clark (1940), Kuznets (1957)]. In the first industrialized countries, technical improvements in agriculture favoured the development of industry and services by releasing labour, increasing demand and raising profits to finance other activities. However, several scholars noted that the positive effects of agricultural productivity on economic development are no longer operative in open economies. In addition, there is a large theoretical literature highlighting how market failures can retard structural transformation in developing countries. In particular, financial frictions might constrain the reallocation of capital and thus retard the process of labour reallocation. In this project, we propose to contribute to our understanding of structural transformation by providing direct empirical evidence on the effects of exogenous shocks to local agricultural and manufacturing productivity on the reallocation of capital and labour across sectors, firms and space in Brazil. For this purpose, we construct the first data set that permits to jointly observe labour and credit flows across sectors and space. To exploit the spatial dimension of the capital allocation problem, we design a new empirical which exploits the geographical structure of bank branch networks. Similarly, we propose to study the spatial dimension of the labour allocation problem by exploiting differences in migration costs across regions due to transportation and social networks.