In this paper we derive a microfounded macro New Keynesian model for open economies, be them large or small. We consider habit formation in consumption, sectoral linkages for tradable and non-tradable goods, capital stock investments with variable capital utilization, domestic and foreign governments, imperfect (exchange rate) pass-through in import prices and incomplete international financial markets. Sticky nominal prices and wages are modeled in Calvo and Taylor staggered ways. The model economy is composed of a continuum of infinitely-lived consumers and producers of final and intermediate goods. We provide a very general log-linearization method, from which we can easily obtain various special cases, as trend inflation or steady-state log-linearizations. Numerical simulations of the two-country sectoral model are provided for a relatively large number of structural shocks as domestic and foreign productivity shocks in final tradables and non-tradables, money demand shocks and a shock in the exchange rate. Such a model is well suited for monetary policy analysis at the international level and risk analysis.