In the admin section go to Promotions > Shopping Cart Rules
Fill in the basic rule information.
Go to the tab "Conditions"
Add a new rule with the following conditions.
You have to do this for both products x and z:
1. Click the + sign and pick the option "Product Attribute Combination".
2. Then below the text "If an item is FOUND in the cart with ALL of these conditions true: " add a sub condition and choose the option "SKU",
3. Select the product X, for the second one product Z.
Go to the tab Actions
Set Discount Amount to 100
Make sure "Apply" is "Percent of the product price discount"
In the section "Apply the rule only to cart items matching the following conditions"
Add a new condition with option "SKU" and select the SKU via the chooser of product Y. Save the rule.
Now the product will be free when a user is buying product X AND Z.