We propose a numerical scheme for singularly perturbed boundary and initial-boundary value problems. This scheme is based upon the asymptotic behavior of singular perturbation problems. From the method of matched asymptotic expansion, simplified problems are obtained which, after some modification, can be solved using appropriate numerical methods. An error analysis has been performed and encompasses both numerical and singular perturbation theory. To show the applicability of this scheme several model problems have been considered. The results of these numerical experiments agree with our theorectical estimates