Coal waste is a potential source of rare-earth elements (REEs) and some economically critical elements recovery. The present study reports the abundance and enrichment of REEs and critical elements in the Hancheng Permo-Carboniferous (Weibei coalfield) and Binxian Jurassic coals (Huanglong coalfield) of Shaanxi, China. The Binxian coal is distinctly enriched in all REEs. The Hancheng coal is enriched in Y, Ce, Sc, La, Yb, Nd, Pr, Gd, Er, Sm and Dy and depleted in Lu, Eu, Ho, Tb and Tm, compared with that of the average earth’s crust abundance (ECA), world coal and the US coal. In the Binxian raw coal, the REEs contents, namely Sc 13.8, Y 13.1, La 27.8, Ce 48.49, Sm 4.1, Nd 22, Eu 0.8, Gd 3.8, Pr 5.43, Dy 2.5, Er 1.4 and Yb 1.3 in mg kg−1. The contents (mg kg−1) of REEs in the Hancheng raw coal were Sc 8.8, Y 18.6, La 34.8, Ce 60.2, Nd 26, Yb 1.8, Eu 01, Pr 6.71, Sm 5.3, Dy 3.4, Tb 0.66, Er 1.9 and Gd 5.16. The contents (mg kg−1) of critical elements in the Binxian raw coal were Cr 30.8, Pb 41.5, Ni 49.7, Cu 35.7, Ba 257.9, V 51.7, Zn 63.1, Li 135, Ga 20.6, U 2.9, Th 10.2 As 12.7, Al 98,887, Fe 23,916 and Ti 4289. The contents (mg kg−1) of critical elements in the Hancheng coal were Cr 384, Pb 56.1, Ni 93.9, Cu 49.5, Ba 371, V 90.7, Zn 7653, Li 183, Ga 35.9, U 4.9, Th 17.7, As 10.1, Al 108,344, Fe 20,433 and Ti 2873. The contents of REEs in the Binxian and Hancheng coals were not in a promising range, whereas some of the critical elements were highly abundant. The Al2O3/TiO2 ratio indicated that the Ordos Basin sediment was derived from intermediate-felsic rocks with a slight variation (r = 0.98). The Eu and Gd show positive anomalies with negative Ce anomalies almost in all the samples. The positive anomalies of Gd represent the intrusion of hydrothermal fluid with possibly Ba interference in the Binxian coal. The high volatile matter in the Binxian coal reflects bituminous to anthracite coal, whereas the low volatility of the Hancheng coal reflects peat to lignite coal. The recovery of the REEs and critical elements as a by-product from these coals may not only increase the revenue but will also lead to an improvement in the environmental quality.