G-quadruplex is a type of DNA secondary structure formed by specific guanine-rich sequences. Because of their enrichment in functional genomic regions and their biological significance, G-quadruplexes are recognized as significant drug targets for cancer and other diseases. Here, we tested the precipitation efficiency of Mg(2+) for various DNA oligomers, including single-stranded, double-stranded, triplex, hairpin, i-motif, and some reported G-quadruplex DNA. It was found that Mg(2+) could specifically recognize and precipitate G-quadruplex DNA with a particularly high efficiency of close to 100% for G-quadruplex structures with parallel conformation, which provided an inexpensive and convenient method for detecting and separating G-quadruplex DNA from other DNA structures as well as identifying parallel G-quadruplex from other conformational G-quadruplexes. Further experiments with both CD and gel electrophoresis validated the effectiveness of this approach. The structure of the precipitate was characterized using transmission electron microscopy (TEM), and the observed linear precipitate suggested that a polymerization of G-quadruplex DNA was formed through π-π stacking of end to end by the unique large aromatic surface of G-quadruplex.