Microgrids of varying size and applications are regarded as a key feature of modernizing the power system. The protection of those systems, however, has become a major challenge and a popular research topic for the reason that it involves greater complexity than traditional distribution systems. This paper addresses the issue through a novel approach which utilizes detailed analysis of current and voltage waveforms through windowed fast Fourier and wavelet transforms. The fault detection scheme involves bagged decision trees which use input features extracted from the signal processing stage and selected by correlation analysis. The technique was tested on a microgrid model developed using PSCAD/EMTDS, which is inspired from an operational microgrid in Goldwind Sc. Tech. Co. Ltd, in Beijing, China. The results showed great level of effectiveness to accurately identify faults from other non-fault disturbances, precisely locate the fault and trigger opening of the right circuit breaker/s under different operation modes, fault resistances and other system disturbances.