This paper investigates whether knowledge similarity improves the performance of foreign firms and, if so, when. Using panel data on foreign and local firms in China for the years 1998-2007, we empirically find a positive relationship between knowledge similarity and the performance of foreign firms. We find two moderating factors for the relationship, namely foreign ownership share, a firm-level factor that positively moderates the relationship, and market-oriented institution, a province-level factor that negatively moderates the relationship. Our findings identify the detailed theoretical mechanism for the effects of knowledge similarity on the performance of foreign firms under different moderating conditions.