The aim of this work is to shed light on the relationship between firms’ performance and their technological portfolios using tools borrowed from the complexity science. In particular, we ask whether the accumulation of knowledge and capabilities related to a coherent set of technologies leads firms to experience advantages in terms of productive efficiency. To this end, we analyzed both the balance sheets and the patenting activities of about 70 thousand firms that have filed at least one patent over the period 2004-2013. From this database it is possible to define a monopartite network of technological fields, that can be used to assess the firms’ technological portfolio, defined as the set of fields in which the given firm is active. We then introduce firms’ coherent diversification, a quantitative assessment that evaluates a technological portfolio counting the number of fields it encompasses weighting each of them on the basis of their coherence with respect to the firm's global knowledge base. Such a measure implicitly favors companies with a diversification structure comprising blocks of closely related fields over firms with the same breadth of scope but a more scattered diversification structure. We find that our measure of the coherent diversification of firms is quantitatively related to their economic performance and, in particular, we prove on a statistical basis that it explains labor productivity better than standard diversification. This is an empirical evidence that this evaluation of technological portfolios captures relevant information about the productive structure of firms. As a consequence, it can be used not only to investigate possible synergies within firms but also to recommend viable partners for merging and acquisitions.