The invention provides novel pyrimidine and pyridine derivatives and pharmaceutical compositions thereof, and methods for using such compounds. For example, the pyrimidine and pyridine derivatives of the invention may be used to treat, ameliorate or prevent a condition which responds to inhibition of anaplastic lymphoma kinase (ALK) activity, focal adhesion kinase (FAK), zeta-chain-associated protein kinase 70 (ZAP-70), insulin-like growth factor (IGF-1R), or a combination thereof.