Digitization and automation are thought to be transforming the economy, but evidence on their adoption and impact is limited. This paper analyzes determinants and effects of firms' investment in these technologies using administrative data from Germany. The main result is that while technology typically substitutes for workers, in several service industries the complementarity effect dominates. This is shown using two approaches: (1) labor scarcity increases investment in technology on average but impedes it in selected industries; (2) technology typically reduces employment but increases it in selected industries. For identification, I instrument labor scarcity with population aging and use a difference-in-differences design that combines industry-level technological trends with local intensity of technology adoption. Additional results show that financial constraints impede technology adoption and that the new technology is skill-biased. Overall, the paper unwinds the heterogeneous link between new technologies and labor, highlighting the importance of analyzing a broad set of technologies and studying patterns of their adoption by firms.