A method of spatially barcoding a target nucleic acid in a biological sample, the method comprising: (a) providing an array comprising a first plurality of capture probes, wherein a first capture probe of the first plurality of capture probes comprises: (i) a first spatial barcode and (ii) a first capture domain, and wherein the first capture probe is attached to a substrate, and a second plurality of capture probes, wherein a second capture probe of the second plurality of capture probes comprises: (iii) a second spatial barcode and (iv) a second capture domain, and wherein the second capture probe is attached to the substrate; (b) hybridizing a first probe oligonucleotide and a second probe oligonucleotide to the target nucleic acid, wherein the first probe oligonucleotide and the second probe oligonucleotide each comprise a sequence that is substantially complementary to a first sequence and a second sequence of the target nucleic acid, respectively, and wherein the first probe oligonucleotide comprises a first capture probe binding domain and the second probe oligonucleotide comprises a second capture probe binding domain; (c) coupling the first probe oligonucleotide and the second probe oligonucleotide, thereby generating a ligation product; (d) releasing the first capture probe and/or the second capture probe from the substrate; and (e) hybridizing (i) the first capture domain of the first capture probe to the first capture probe binding domain of the ligation product, and optionally, (ii) the second capture domain of the second capture probe to the second capture probe binding domain of the ligation product, thereby spatially barcoding the target nucleic acid in the biological sample. (a) providing an array comprising a first plurality of capture probes, wherein a first capture probe of the first plurality of capture probes comprises: (i) a first spatial barcode and (ii) a first capture domain, and wherein the first capture probe is attached to a substrate, and a second plurality of capture probes, wherein a second capture probe of the second plurality of capture probes comprises: (iii) a second spatial barcode and (iv) a second capture domain, and wherein the second capture probe is attached to the substrate; (b) hybridizing a first probe oligonucleotide and a second probe oligonucleotide to the target nucleic acid, wherein the first probe oligonucleotide and the second probe oligonucleotide each comprise a sequence that is substantially complementary to a first sequence and a second sequence of the target nucleic acid, respectively, and wherein the first probe oligonucleotide comprises a first capture probe binding domain and the second probe oligonucleotide comprises a second capture probe binding domain; (c) coupling the first probe oligonucleotide and the second probe oligonucleotide, thereby generating a ligation product; (d) releasing the first capture probe and/or the second capture probe from the substrate; and (e) hybridizing (i) the first capture domain of the first capture probe to the first capture probe binding domain of the ligation product, and optionally, (ii) the second capture domain of the second capture probe to the second capture probe binding domain of the ligation product, thereby spatially barcoding the target nucleic acid in the biological sample.