Piecewise affine model is a useful tool for approximating nonlinear systems. In this paper, we first propose a procedure for obtaining the piecewise affine ARX models of nonlinear systems. Two parameters which fully characterize a piecewise affine ARX model, namely the parameters of the locally linear/affine subsystems, as well as the partitions of the regressor space, will be estimated, the former through a least-squares based identification method using multiple models, and the latter using standard procedures such as neural network classifier or support vector machine classifier. Based on the piecewise affine ARX model of the nonlinear system, we then proceed to derive a model-based controller to control the system for reference tracking. Simulation studies show that our algorithm can indeed provide accurate piecewise affine approximation of nonlinear systems, and that the proposed controller provides good tracking performance.