An algebraic multilevel iteration method for solving system of linear algebraic equations arising in $H(mathrm{curl})$ and $H(mathrm{div})$ spaces are presented. The algorithm is developed for the discrete problem obtained by using the space of lowest order Nedelec and Raviart-Thomas-Nedelec elements. The theoretical analysis of the method is based only on some algebraic sequences and generalized eigenvalues of local (element-wise) problems. In the hierarchical basis framework, explicit recursion formulae are derived to compute the element matrices and the constant $gamma$ (which measures the quality of the space splitting) at any given level. It is proved that the proposed method is robust with respect to the problem parameters, and is of optimal order complexity. Supporting numerical results, including the case when the parameters have jumps, are also presented.