An automatic system for closing windows or doors, comprising: - a counter-plate installable on a fixed frame and provided with a first member; - a lock body installable on a door or window leaf and having a front portion intended to face said counter-plate when the door or window leaf is aligned with the fixed frame, wherein said lock body is provided with closing means movable between a release configuration, wherein the closing means engages the counter-plate when the counter-plate is aligned with the lock body, and a retained configuration, wherein the closing means is maintained inside the lock body and does not engage the counter-plate; - a switch mounted in the lock body, said switch being configured to assume a locking configuration wherein the switch locks the closing means in the retained configuration and a unlocking configuration wherein the switch unlocks the closing means, thereby activating the automatic movement of the closing means from the retained configuration to the release configuration; characterised in that said switch and said first member are configured to exchange an activation magnetic-type action adapted to switch said switch from the locking configuration to the unlocking configuration only in a final approaching step of said lock body with respect to said counter-plate, which is a part of a closing step starting from when the lock body is partially facing the counter-plate and ending when the lock body is completely facing the counter-plate, said switch having a first leaf-side magnetic pole active at the front portion of the lock body and said first member having a frame-side magnetic pole active at a front portion of said counter-plate, wherein said first leaf-side magnetic pole is active only on an opening side so as to magnetically interact with said first frame-side magnetic pole only in said final approaching step and exchange said activation magnetic-type action. - a counter-plate installable on a fixed frame and provided with a first member; - a lock body installable on a door or window leaf and having a front portion intended to face said counter-plate when the door or window leaf is aligned with the fixed frame, wherein said lock body is provided with closing means movable between a release configuration, wherein the closing means engages the counter-plate when the counter-plate is aligned with the lock body, and a retained configuration, wherein the closing means is maintained inside the lock body and does not engage the counter-plate; - a switch mounted in the lock body, said switch being configured to assume a locking configuration wherein the switch locks the closing means in the retained configuration and a unlocking configuration wherein the switch unlocks the closing means, thereby activating the automatic movement of the closing means from the retained configuration to the release configuration; said switch and said first member are configured to exchange an activation magnetic-type action adapted to switch said switch from the locking configuration to the unlocking configuration only in a final approaching step of said lock body with respect to said counter-plate, which is a part of a closing step starting from when the lock body is partially facing the counter-plate and ending when the lock body is completely facing the counter-plate, said switch having a first leaf-side magnetic pole active at the front portion of the lock body and said first member having a frame-side magnetic pole active at a front portion of said counter-plate, wherein said first leaf-side magnetic pole is active only on an opening side so as to magnetically interact with said first frame-side magnetic pole only in said final approaching step and exchange said activation magnetic-type action.