Let T be a tree with vertex set [n]={1,2,…,n}. For each i∈[n], let mi be a positive integer. An ordered pair of two adjacent vertices is called an arc. Each arc (i,j) of T has a weight Wi,j which is an mi×mj matrix. For two vertices i,j∈[n], let the unique directed path from i to j be Pi,j=x0,x1,…,xd where d⩾1, x0=i and xd=j. Define the product distance from i to j to be the mi×mj matrix Mi,j=Wx0,x1Wx1,x2⋯Wxd−1,xd. Let . The N×N product distance matrix D of T is a partitioned matrix whose (i,j)-block is the matrix Mi,j. We give a formula for det(D). When det(D)≠0, the inverse of D is also obtained. These generalize known results for the product distance matrix when either the weights are real numbers, or m1=m2=⋯=mn=s and the weights Wi,j=Wj,i=We for each edge e={i,j}∈E(T).