We propose a finite automaton based algorithm for identification of infinite clusters in a 2D rectangular lattice with L=X×Y cells. The algorithm counts infinite clusters and finds one path per infinite cluster in a single pass of the finite automaton. The finite automaton is minimal according to the number of states among all the automata that perform such task. The correctness and efficiency of the algorithm are demonstrated on a planar percolation problem. The algorithm has a computational complexity of O(L) and could be appropriate for efficient data flow implementation.