To overcome the structural instability of polyaniline (PANI) due to repeated volumetric swelling and shrinking during charge/discharge process, the LDH/PANI composite was designed and prepared via the assembly of organic PANI and 2D host nanosheets from the MgFe layered double hydroxide (MgFe-LDH) through incorporation of PANI between the nanosheets gap using in situ polymerization. Owing to the combined advantages of conducting PANI and 2D nanosheets, the LDH/PANI composite exhibited excellent supercapacitive performance, including low resistance, high specific capacitance, good charge/discharge stability and long-term cycling life, which greatly improved faradaic redox reaction and mass transfer. As electrode material for supercapacitors, the LDH/PANI composite showed a maximum specific capacitance of 592.5 F·g−1 at a current density of 2 A·g−1, and achieved remarkable capacitance retentions of 87% after 500 cycles. The LDH/PANI material may be a potential economical alternative electrode material for supercapacitors.