A Spark is the heart of every Cybertronian, which Energon flows through. It is a Transformer's soul and life force wich resides within the chest and is protected by the Laser Core, the spherical shell that protects the Spark and connects it to the neural system. Every Cybertronian has one. If they don't, then they are probably deceased, unless they turn into a Terrorcon. It is shown that a spark has a heart beat like those of humans and that Cybertronians are able to share their split spark with their fellow siblings.
As part of the Thirteen's plan to defeat Unicron, Optimus Prime exposed his spark, its frequency almost identical to Primus's own, to Unicron's Anti-Spark, the resulting interaction between the two knocking both beings into stasis lock. After being poisoned by Dark Energon, Primus inserted an untainted portion of his spark into the Matrix of Leadership which he bestowed upon Optimus Prime.
The shard managed to keep him alive after being at ground zero of a Space Bridge explosion, before another shard, plunged directly into his spark, restored his body to full functionality.
After Megatron perished, Deadlock the lasting consequence of this was revealed with Megatron's polluted spark now severed from the AllSpark and bound to Unicron's Anti-Spark, allowing the Dark God to possess Megatron's corpse.
In order to prevent Unicron from devouring the physical AllSpark, Optimus Prime merged the AllSpark with the Matrix of Leadership and thus his own spark. Unable to separate the three, Optimus willingly surrendered his life to allow new generations to exist on Cybertron. The AllSpark rejoining the Core caused it to ignite and birth a multitude of new sparks.
Before Optimus could pass into the afterlife, the Thirteen intercepted his spark and brought it to their realm. To provide Optimus with the power needed to defeat Megatronus, the Primes bestowed upon him a portion of their power, directly from their sparks. They later took it back but doing so left Optimus substantially weakened.